RestHelper: extension should override accept header for json / xml detection #942

tackley opened this Issue Mar 18, 2011 · 1 comment

3 participants


I'm experimenting with the simply lift example rest app:,
with the latest lift 2.3-SNAPSHOT.

The Accept header detection overrides the url extension

curl http://localhost:8080/simple3/item/1234
curl http://localhost:8080/simple3/item/1234.json

returns json as expected, but:

curl http://localhost:8080/simple3/item/1234.xml

also returns json. This appears to be because curl sends by default an

Accept: /
header, so to get xml you have to:

curl -H "Accept:" http://localhost:8080/simple3/item/1234.xml

to stop curl sending an Accept header.

Experience with our api ( is that developers always get the extension right, but are not so good at getting Accept headers right... And I always test an api with curl
before writing any code, I guess other people do too, so the curl use case is particularly confusing.

[The background: is implemented in scala with Guice and plain servlets. I'm considering moving the code to use RestHelper.]

Is it possible to make the extension, if provided and valid, always override the accept headers?

@dpp dpp was assigned Mar 1, 2012
@etorreborre etorreborre pushed a commit to etorreborre/framework that referenced this issue Dec 3, 2014
@dpp dpp Fixes #942. json and xml requests do not match */* as documented 655789c
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment