Only write non-default charset in FormHttpMessageConverter
This commit only writes the 'charset' parameter in the written headers if it is non-default (not UTF-8), since RFC7578 states that the only allowed parameter is 'boundary'. See gh-25885 Closes gh-26290
This commit is contained in:
@@ -475,7 +475,10 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
|
||||
|
||||
byte[] boundary = generateMultipartBoundary();
|
||||
if (!isFilenameCharsetSet()) {
|
||||
parameters.put("charset", this.charset.name());
|
||||
if (!this.charset.equals(StandardCharsets.UTF_8) &&
|
||||
!this.charset.equals(StandardCharsets.US_ASCII)) {
|
||||
parameters.put("charset", this.charset.name());
|
||||
}
|
||||
}
|
||||
parameters.put("boundary", new String(boundary, StandardCharsets.US_ASCII));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user