This project is archived and is in readonly mode.
406 Unacceptable received for something the Accept header has said it can take
Reported by Russell Garner | November 17th, 2010 @ 11:31 AM
I have a "build your own feed" kind of HTML form which POSTs to a controller action which can only return ATOM:
respond_to :atom
.
.
respond_with(@articles = Article.paged_since(@date, params[:path], params[:page], params[:include_deleted]))
The browser's Accept
header is Firefox's
default:
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
Unfortunately, posting to this action yields "406 Unacceptable" despite the fact the browser has said we can accept anything and we have an ATOM representation ready to go (this used to work in 2.3.5 - I've hit this apropos of upgrading to 3.0.3). I think this is an error - do people agree? It seems to be related to the following ticket:
https://rails.lighthouseapp.com/projects/8994/tickets/3541-content-...
Before I start looking at how to be a contributor, is there anything obvious to anyone else that I've missed?
Cheers.
Comments and changes to this ticket
-
Russell Garner November 17th, 2010 @ 05:51 PM
- no changes were found...
-
José Valim November 19th, 2010 @ 10:31 AM
- State changed from new to wontfix
- Importance changed from to Low
Yes, but this can't be fixed. Some browsers (cof cof IE) are really retarded when sending accept headers in the sense it may pass image/png or atom with higher priority than text/html. So rails tries to detect everything that looks like a bad browser request and defaults it to HTML. sorry, but You will need to pass :format => :atom as option to form_for or ensure in other way .atom is present at the end of the URL.
-
Russell Garner November 19th, 2010 @ 10:56 AM
If I found a way to make the above tests pass in addition to everyone else's, would you consider a patch? I'm actually hacking the
request.format = :atom
in the controller action at the moment, but I don't believe serving a 406 when any agent (browser or otherwise) has said they can accept anything and there are formats there waiting is good HTTP. We're letting bad browsers like (cough cough ;)) IE dictate good HTTP-related server practice. -
José Valim November 19th, 2010 @ 11:53 AM
Yes, if you find a way to circumvent the issue, a patch is welcome. :)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 3541 Content Negotiation Regression Have opened a ticket at https://rails.lighthouseapp.com/...