apiaryio / api-blueprint

API Blueprint
https://apiblueprint.org
MIT License
8.64k stars 2.14k forks source link

Support Multiple HTTP Headers #345

Open BigBlueHat opened 7 years ago

BigBlueHat commented 7 years ago

It seems that API Blueprint doesn't allow for multiple HTTP headers.

According to ye olde RFC 2616 it is possible to have multiple HTTP headers. [RFC 7230]() makes it clearer:

   A sender MUST NOT generate multiple header fields with the same field
   name in a message unless either the entire field value for that
   header field is defined as a comma-separated list [i.e., #(values)]
   or the header field is a well-known exception (as noted below).

Things like the Prefer and Link headers are often presented on individual lines for legibility.

API Blueprint currently requires that you present them on a single line as a comma separated list (which is fine enough), but making it more legible by allowing them to be written on separate lines, would be ideal.

Thanks! :tophat:

zdne commented 7 years ago

For completeness, the Set-Cookie and Link header are "tolerated" by parser. Question is whether:

  1. Keep the white list of header that can appear multiple times
  2. Remove this warning completely

Seems like me and @BigBlueHat are up for removing the warning altogether...

zdne commented 7 years ago

Notes on current implementation https://github.com/apiaryio/snowcrash/issues/75#issuecomment-58886108

BigBlueHat commented 7 years ago

Removing the warning has the advantage of allowing people to create their own custom headers which could potentially be defined as having comma separated list values. Hard to know the future, so "be liberal in what you accept from others." :smile: