Closed bbamsch closed 7 years ago
You're right, and that is intentional; this is a RFC 7231 parser, and RFC 7231 defines it less restrictive. You'd be interested in the https://github.com/jshttp/media-typer module :) which is a RFC 6838 parser.
Aha, the confusion came from the docstring standing above the regular expression. See: https://github.com/jshttp/content-type/blob/c9da3ac941b642b80f2110a240e6f2c2d447534f/index.js#L41
The docstring improperly references RFC 6838. I can put together a quick patch for updating the comment.
Yes, I was just looking at your link :) The comment is indeed wrong, and if you'd like to patch it up, I'd absolutely accept 👍
It should say "RFC 7231 sec 3.1.1.1"
According to RFC 6838 spec, content-type naming should follow ABNF format as shown...
Current (as of commit c9da3ac) content type regular expression is less restrictive than specified above.
For example, the following characters are considered valid during type checking while they do not appear in RFC 6838:
To conform with RFC 6838 spec, the following changes should be made...