1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2017 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -96,7 +96,7 @@ protected AbstractHttpMessageConverter(Charset defaultCharset, MediaType... supp
96
96
* Set the list of {@link MediaType} objects supported by this converter.
97
97
*/
98
98
public void setSupportedMediaTypes (List <MediaType > supportedMediaTypes ) {
99
- Assert .notEmpty (supportedMediaTypes , "'supportedMediaTypes' must not be empty" );
99
+ Assert .notEmpty (supportedMediaTypes , "MediaType List must not be empty" );
100
100
this .supportedMediaTypes = new ArrayList <>(supportedMediaTypes );
101
101
}
102
102
@@ -231,8 +231,8 @@ public HttpHeaders getHeaders() {
231
231
232
232
/**
233
233
* Add default headers to the output message.
234
- * <p>This implementation delegates to {@link #getDefaultContentType(Object)} if a content
235
- * type was not provided, set if necessary the default character set, calls
234
+ * <p>This implementation delegates to {@link #getDefaultContentType(Object)} if a
235
+ * content type was not provided, set if necessary the default character set, calls
236
236
* {@link #getContentLength}, and sets the corresponding headers.
237
237
* @since 4.2
238
238
*/
@@ -256,7 +256,7 @@ else if (MediaType.APPLICATION_OCTET_STREAM.equals(contentType)) {
256
256
headers .setContentType (contentTypeToUse );
257
257
}
258
258
}
259
- if (headers .getContentLength () < 0 ) {
259
+ if (headers .getContentLength () < 0 && ! headers . containsKey ( HttpHeaders . TRANSFER_ENCODING ) ) {
260
260
Long contentLength = getContentLength (t , headers .getContentType ());
261
261
if (contentLength != null ) {
262
262
headers .setContentLength (contentLength );
0 commit comments