I'm trying to hit my server's endpoint with a multipart/form-data
request sent from Postman. I'm getting a 400 Bad Request and the cause is:
org.jvnet.mimepull.MIMEParsingException: Missing start boundary.
How can I set the start boundary and how do I know what it should be?
The boundary is included to separate name/value pair in the multipart/form-data . The boundary parameter acts like a marker for each pair of name and value in the multipart/form-data. The boundary parameter is automatically added to the Content-Type in the http (Hyper Text Transfer Protocol) request header.
multipart/form-data contains boundary to separate name/value pairs. The boundary acts like a marker of each chunk of name/value pairs passed when a form gets submitted. The boundary is automatically added to a content-type of a request header.
UPDATE: I have created a video on sending multipart/form-data requests to explain this better. Actually, Postman can do this. You DON'T need to add any headers, Postman will do this for you automatically. Be careful with explicit Content-Type header.
https://github.com/postmanlabs/postman-app-support/issues/191 Following that thread here seems that setting the request header to Content-Type multipart/form-data I'm overriding the value set by Postman.
There is no need to add a content-type header manually. You are overriding the value set by Postman. Just select form-data in POST request and send your request to see if it works.
Removing the header allowed me to hit my endpoint.
Overriding POSTMAN header values is the issue as mentioned by Anton above. Here is how your headers and request body should look like for standalone POSTMAN client:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With