Skip to content

Commit 1050e94

Browse files
committed
default content-type: application/json
1 parent 56be654 commit 1050e94

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

aws-serverless-java-container-springboot3/src/main/java/com/amazonaws/serverless/proxy/spring/AwsSpringHttpProcessingUtils.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.springframework.cloud.function.serverless.web.ServerlessHttpServletRequest;
1818
import org.springframework.cloud.function.serverless.web.ServerlessMVC;
1919
import org.springframework.http.HttpHeaders;
20+
import org.springframework.http.MediaType;
2021
import org.springframework.util.CollectionUtils;
2122
import org.springframework.util.FileCopyUtils;
2223
import org.springframework.util.MultiValueMapAdapter;
@@ -194,9 +195,7 @@ private static void populateContentAndContentType(
194195
boolean base64Encoded,
195196
ServerlessHttpServletRequest httpRequest) {
196197
if (StringUtils.hasText(body)) {
197-
if (contentType == null) {
198-
httpRequest.setContentType("application/json");
199-
}
198+
httpRequest.setContentType(contentType == null ? MediaType.APPLICATION_JSON_VALUE : contentType);
200199
if (base64Encoded) {
201200
httpRequest.setContent(Base64.getMimeDecoder().decode(body));
202201
} else {

0 commit comments

Comments
 (0)