Skip to content

Commit b69f581

Browse files
committed
Making sure we infer the content-type on streaming operations and actually add it (unless there's already a non-blank Content-Type)
1 parent c138e92 commit b69f581

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/src/main/java/software/amazon/awssdk/core/runtime/transform/StreamingRequestMarshaller.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import static software.amazon.awssdk.http.Headers.CONTENT_LENGTH;
1919
import static software.amazon.awssdk.http.Headers.CONTENT_TYPE;
20+
import static software.amazon.awssdk.utils.StringUtils.isBlank;
2021
import static software.amazon.awssdk.utils.Validate.paramNotNull;
2122

2223
import software.amazon.awssdk.annotations.SdkProtectedApi;
@@ -47,7 +48,7 @@ public StreamingRequestMarshaller(Marshaller<Request<T>, T> delegate, RequestBod
4748
public Request<T> marshall(T in) {
4849
Request<T> marshalled = delegate.marshall(in);
4950
marshalled.setContent(requestBody.asStream());
50-
if (!marshalled.getHeaders().containsKey(CONTENT_TYPE)) {
51+
if (!marshalled.getHeaders().containsKey(CONTENT_TYPE) || isBlank(marshalled.getHeaders().get(CONTENT_TYPE))) {
5152
marshalled.addHeader(CONTENT_TYPE, requestBody.contentType());
5253
}
5354

0 commit comments

Comments
 (0)