Skip to content

Commit 6d60c23

Browse files
bclozelsnicoll
authored andcommitted
Disable Accept-Charset Header in String converter
This commit prevents the `Accept-Charset` from being written by the StringHttpMessageConverter. This feature is enabled by default in the framework and writes a *quite long* response header with all charsets supported by the server. Closes gh-2370, see gh-1800
1 parent ff2d423 commit 6d60c23

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ protected static class StringHttpMessageConverterConfiguration {
144144
@Bean
145145
@ConditionalOnMissingBean
146146
public StringHttpMessageConverter stringHttpMessageConverter() {
147-
return new StringHttpMessageConverter(this.encodingProperties.getCharset());
147+
StringHttpMessageConverter converter = new StringHttpMessageConverter(this.encodingProperties.getCharset());
148+
converter.setWriteAcceptCharset(false);
149+
return converter;
148150
}
149151

150152
}

0 commit comments

Comments
 (0)