mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-22 05:49:04 +00:00
Improve ResourceHttpMessageConverter target type support
This commit updates the target type detection in `ResourceHttpMessageConverter` to only support target types that are relevant: `InputStreamResource` for streaming, and types assignable from `ByteArrayResource` for non-streaming cases. Closes gh-36368
This commit is contained in:
+1
-1
@@ -93,7 +93,7 @@ public class ResourceHttpMessageConverter extends AbstractHttpMessageConverter<R
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (Resource.class == clazz || ByteArrayResource.class.isAssignableFrom(clazz)) {
|
||||
else if (clazz.isAssignableFrom(ByteArrayResource.class)) {
|
||||
byte[] body = StreamUtils.copyToByteArray(inputMessage.getBody());
|
||||
return new ByteArrayResource(body) {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user