Closed kamui closed 12 years ago
I'm pretty sure this isn't a bug, it's a feature. To quote the spec:
Each media-range MAY be followed by one or more accept-params, beginning with the "q" parameter for indicating a relative quality factor. The first "q" parameter (if any) separates the media-range parameter(s) from the accept-params. Quality factors allow the user or user agent to indicate the relative degree of preference for that media-range, using the qvalue scale from 0 to 1 (section 3.9). The default value is q=1.
In your example, since application/xml
and application/xhtml+xml
don't explicitly specify a qvalue it should default to 1. The comma is indeed a delimiter, and does not mean "use the qvalue of whatever comes after me".
Ahh.. that makes so much more sense. I read the spec wrong, or misread examples of it. Thanks!
I noticed this bug when playing with multiple media types and q values.
An accepts header like this:
should generate a
qvalues
hash like this:But
rack-accept
splits the header on,
and then assumes any type without a q value will have a q value of 1. So we get this instead:This is might be a complicated problem to solve, since you'd have to regex for accept-extensions and then apply those values to all the media types that came before it.