Reputation: 51
I am trying to get the form data from a multipart/form-data POST to my AWS Http Body Mapping Templates web service.
The HTTP POST request (using postman) has Content-Type "multipart/form-data" and body is form-data with 3 key-value contents that one of them is File.
If I call the http endpoint directly (not through the API gateway) - using postman or mobile, it works as expected, however, using the API gateway endpoint (through postman) fails.
My server method is:
public ResponseEntity MethodName(MultipartHttpServletRequest request) {...}
But my request even entered to my method body and throws an exception "Could not parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found"
.
I have also tried setting the Http -> Integration Request -> Body Mapping Templates for content type multipart/form-data (with content {"body" : "$input.body"}
or {"body" : $input.body}
) to Input passthrough. This didn't help either.
Upvotes: 1
Views: 5559
Reputation: 4152
API Gateway does not currently support multipart form data. This is being considered for future development. In the meantime, you will need to modify your clients to not use multipart requests.
See API Gateway - Post multipart\form-data
Upvotes: -1