6

Is a multipart/form-data request valid without a boundary? According to the specification when there are more than 1 parts then boundary is used to separate them(and this boundary should not be part of the body). I have a request where there is a single body as a raw content or a file and in the content-type we pass "multipart/form-data" . Is this kind of request actually valid?

1 Answer 1

10

I think multipart/form-data request without a boundary is invalid.

According to RFC7231, request with only 1 part is still valid multipart MIME type and should follow multipart MIME rules:

MIME provides for a number of "multipart" types -- encapsulations of one or more representations within a single message body. All multipart types share a common syntax ... and include a boundary parameter as part of the media type value.

According to RFC2046, "boundary" is required and mandatory:

The Content-Type field for multipart entities requires one parameter, "boundary".

...

The only mandatory global parameter for the "multipart" media type is the boundary parameter

Sign up to request clarification or add additional context in comments.

1 Comment

FYI: This is also conclusive with the multipart/form-data media type registry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.