Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

acceptsStarStar broken for weighted accept entries #1186

Open
indrajitr opened this Issue · 1 comment

3 participants

@indrajitr
Owner

I have a simple feed that uses serveJx to select the return type (json
or xml) based on the request Accept header and the extension (.json
or .xml). This generally works fine except in one case I've found. If
the extension is .xml, I get back json. I have traced this back to a
bug in Req.acceptsStarStar in version 2.4-M4, which looks like this:

lazy val acceptsStarStar : Boolean = accepts.map(_ == "/") openOr
false

In my case accepts = Full(text/html,application/xhtml+xml,application/
xml;q=0.9,/;q=0.8). Note that the last entry is weighted. Thus, the
above comparison to "/" fails and acceptsStarStar returns false,
when in fact it should be true because "/" is present, just with a
weight, which is a valid format (see weightedAccepts in Req).

The full call stack is:

serveJx
jxSel
jsonResponse_?
acceptsStarStar

Weighted accept is List(ContentType(text,html,0,Empty,List()),
ContentType(application,xhtml+xml,1,Empty,List()),
ContentType(application,xml,2,Full(0.9),List()), ContentType(,,
3,Full(0.8),List()))

Thanks.

@dpp dpp was assigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.