Enforce UTF-8 response encoding in SseEmitter
This commit sets the response content type to "text/event-stream;charset=UTF-8". Even if the SSE spec says that the encoding should always be UTF-8 and that specifying the charset is optional, we're setting it in all cases, since some containers might use the default encoding "ISO-8859-1" and confuse HTTP clients. Issue: SPR-14407
This commit is contained in:
@@ -148,7 +148,7 @@ public class ResponseBodyEmitterReturnValueHandlerTests {
|
||||
|
||||
assertTrue(this.request.isAsyncStarted());
|
||||
assertEquals(200, this.response.getStatus());
|
||||
assertEquals("text/event-stream", this.response.getContentType());
|
||||
assertEquals("text/event-stream;charset=UTF-8", this.response.getContentType());
|
||||
|
||||
SimpleBean bean1 = new SimpleBean();
|
||||
bean1.setId(1L);
|
||||
@@ -178,7 +178,7 @@ public class ResponseBodyEmitterReturnValueHandlerTests {
|
||||
|
||||
assertTrue(this.request.isAsyncStarted());
|
||||
assertEquals(200, this.response.getStatus());
|
||||
assertEquals("text/event-stream", this.response.getContentType());
|
||||
assertEquals("text/event-stream;charset=UTF-8", this.response.getContentType());
|
||||
assertEquals("bar", this.response.getHeader("foo"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user