Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postman multipart/form-data error: Missing start boundary

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?

enter image description here

like image 282
Anton Belev Avatar asked Oct 16 '15 15:10

Anton Belev


People also ask

How do you set boundary multipart form data?

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.

What is boundary in Content-Type multipart form data?

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.

Can we send multipart form data in Postman?

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.


2 Answers

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.

like image 196
Anton Belev Avatar answered Oct 23 '22 21:10

Anton Belev


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:

Request Headers Request Body

like image 38
realPK Avatar answered Oct 23 '22 20:10

realPK