14

Should the Content-Type header in a REST API web request be formatted with a comma as in RFC 1867:

Content-type: multipart/form-data, boundary=AaB03x

Or with a semicolon, as in RFC 1049 and RFC 2045:

Content-Type: multipart/mixed; boundary=gc0p4Jq0M2Yt08j34c0p

4 Answers 4

17
+500

It's really all just a simple mistake and the ; is correct.

RFC 1867 was an experimental definition. All subsequent definitions have corrected this mistake. For example:

  • RFC 2388 explicitly replaces 1867 and refers to HTML 40 for the (correct) definition of the separator.
  • RFC 7231 explicitly refers to 2388 as the definition to use in HTTP/1.1.

And finally... there is also an official correction to RFC 1867 to make it use the correct delimiter.

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

2 Comments

So to summarise, the ; is correct? (I'm surprised you wrote all that and missed this fact out)
@jasdeepkhalsa Yes - now clarified. The detail was requested by the OP to prove which interpretation was correct.
3

Rely on the newest RFC: 7231, section 3.1.1.1 says:

media-type = type "/" subtype *( OWS ";" OWS parameter )

This leaves no room for interpretations or custom formats.

1 Comment

Does it say somewhere that this supersedes the RFCs in the question?
0

Unfortunately, it's not the first case I see, when several RFCs conflicts one with another.

In this exact case, RFC 1049 is explicitly cover Content-type header. RFC 2045 is referencing to RFC 1049. Moreover, RFC 2045 dated November 1996, so it's latest one.

Opposite case is covered in RFC 1867 very briefly.

So, I suggest to use semi-colon.

Comments

0

Note that your two conflicting examples aren't really contradictory. The first, RFC-1867, defines extensions to HTML. The other two, RFC-1049 and RFC-2045, both define extensions to the Internet Mail protocol.

For a REST API, I would probably go with RFC-1867, which was designed with HTML over HTTP in mind, as opposed to the other two, which were designed with RFC-822-based emails over SMTP/POP/IMAP in mind.

Comments

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.