Switch writeAcceptCharset to false by default

Closes gh-22506
This commit is contained in:
Rossen Stoyanchev
2019-05-08 09:56:52 -04:00
parent a9f0eae4ab
commit 7e6e3d7027
9 changed files with 14 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -107,6 +107,7 @@ public class ObjectToStringHttpMessageConverterTests {
@Test
public void writeAcceptCharset() throws IOException {
this.converter.setWriteAcceptCharset(true);
this.converter.write(new Date(), null, this.response);
assertNotNull(this.servletResponse.getHeader("Accept-Charset"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@ public class StringHttpMessageConverterTests {
assertEquals(body, this.outputMessage.getBodyAsString(StandardCharsets.ISO_8859_1));
assertEquals(new MediaType("text", "plain", StandardCharsets.ISO_8859_1), headers.getContentType());
assertEquals(body.getBytes(StandardCharsets.ISO_8859_1).length, headers.getContentLength());
assertFalse(headers.getAcceptCharset().isEmpty());
assertTrue(headers.getAcceptCharset().isEmpty());
}
@Test
@@ -91,7 +91,7 @@ public class StringHttpMessageConverterTests {
assertEquals(body, this.outputMessage.getBodyAsString(StandardCharsets.UTF_8));
assertEquals(TEXT_PLAIN_UTF_8, headers.getContentType());
assertEquals(body.getBytes(StandardCharsets.UTF_8).length, headers.getContentLength());
assertFalse(headers.getAcceptCharset().isEmpty());
assertTrue(headers.getAcceptCharset().isEmpty());
}
@Test // SPR-8867
@@ -106,7 +106,7 @@ public class StringHttpMessageConverterTests {
assertEquals(body, this.outputMessage.getBodyAsString(StandardCharsets.UTF_8));
assertEquals(TEXT_PLAIN_UTF_8, headers.getContentType());
assertEquals(body.getBytes(StandardCharsets.UTF_8).length, headers.getContentLength());
assertFalse(headers.getAcceptCharset().isEmpty());
assertTrue(headers.getAcceptCharset().isEmpty());
}
}