Skip to content

Commit

Permalink
default content-type: application/json
Browse files Browse the repository at this point in the history
  • Loading branch information
deki committed Nov 25, 2024
1 parent 56be654 commit 1050e94
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.springframework.cloud.function.serverless.web.ServerlessHttpServletRequest;
import org.springframework.cloud.function.serverless.web.ServerlessMVC;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.CollectionUtils;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.MultiValueMapAdapter;
Expand Down Expand Up @@ -194,9 +195,7 @@ private static void populateContentAndContentType(
boolean base64Encoded,
ServerlessHttpServletRequest httpRequest) {
if (StringUtils.hasText(body)) {
if (contentType == null) {
httpRequest.setContentType("application/json");
}
httpRequest.setContentType(contentType == null ? MediaType.APPLICATION_JSON_VALUE : contentType);
if (base64Encoded) {
httpRequest.setContent(Base64.getMimeDecoder().decode(body));
} else {
Expand Down

0 comments on commit 1050e94

Please sign in to comment.