Skip to content

Regression: BufferedImageHttpMessageConverter does not set content-type header [SPR-13906] #18480

@spring-projects-issues

Description

@spring-projects-issues

Martin Bonato opened SPR-13906 and commented

Commit 8ab2e4 for #17312 added support for streaming to BufferedImageHttpMessageConverter. However, it breaks setting the content-type header on non-streaming HttpOutputMessages like ServerServletHttpOutputMessage (also used in MockMvc unit tests).

getBody() is called on the outputMessage before the content-type header is added:

writeInternal(image, contentType, outputMessage.getHeaders(),
          outputMessage.getBody());

Calling ServerServletHttpOutputMessage.getBody() causes headers to get written. Headers added afterwards have no effect.


Affects: 4.2 GA, 4.2.1, 4.2.2, 4.2.3, 4.2.4

Reference URL: https://github.com/mbonato/testcase-springframework-SPR-13906

Issue Links:

Referenced from: commits 39c05c5, b49235a

1 votes, 3 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions