File tree Expand file tree Collapse file tree
spring-web/src/main/java/org/springframework/http/converter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -252,13 +252,14 @@ else if (MediaType.APPLICATION_OCTET_STREAM.equals(contentType)) {
252252 contentTypeToUse = (mediaType != null ? mediaType : contentTypeToUse );
253253 }
254254 if (contentTypeToUse != null ) {
255+ String value = contentTypeToUse .toString ();
255256 if (contentTypeToUse .getCharset () == null ) {
256257 Charset defaultCharset = getDefaultCharset ();
257258 if (defaultCharset != null ) {
258- contentTypeToUse = new MediaType ( contentTypeToUse , defaultCharset );
259+ value += ";charset=" + defaultCharset . name ( );
259260 }
260261 }
261- headers .setContentType ( contentTypeToUse );
262+ headers .set ( HttpHeaders . CONTENT_TYPE , value );
262263 }
263264 }
264265 if (headers .getContentLength () < 0 && !headers .containsHeader (HttpHeaders .TRANSFER_ENCODING )) {
You can’t perform that action at this time.
0 commit comments