From 6e0dfd6999aaec4590625de9f818abab16c3aa92 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Wed, 8 May 2019 09:40:32 -0400 Subject: [PATCH] Check if Accept-Charset is present before adding it Closes gh-22506 --- .../http/converter/StringHttpMessageConverter.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/converter/StringHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/StringHttpMessageConverter.java index bf493f3179..6f393b6235 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/StringHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/StringHttpMessageConverter.java @@ -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. @@ -22,6 +22,7 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpInputMessage; import org.springframework.http.HttpOutputMessage; import org.springframework.http.MediaType; @@ -72,7 +73,9 @@ public class StringHttpMessageConverter extends AbstractHttpMessageConverterDefault is {@code true}. */ public void setWriteAcceptCharset(boolean writeAcceptCharset) { @@ -99,10 +102,11 @@ public class StringHttpMessageConverter extends AbstractHttpMessageConverter