Since we're on the topic of Catalyst and REST, I hereby declare Firefox 2.x broken.
There's this great set of modules under the moniker Catalyst::Action::REST that easily adds REST support to Catalyst. While I have no REST API in Mango (yet), I also use this package to do Content-Type -> View negotiations (text/html-> View::HTML, application/xhtml+xml->View::XHTML, application/atom+xml->View::Atom, etc), and it does it quite well.
Unfortunately, Firefox 2.x throws a kink in the works. The REST controller looks at the Content-Type header, then falls back to the content-type query param, then falls back to the Accept header. It's that last thing that kills. You see, firefox sends this accept header:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Re:Browsers suck
jk2addict on 2008-01-17T15:23:12
Now that I think about your response and the issue a little more, it seems even selecting text/html just because it's in the Accept is risky.
I'd wager now, the best approach would be a config option to tell REST to ignore the Accept header altogether and instead go with the default type in config (even per controller).Re:Browsers suck
sjn on 2008-01-18T10:59:18
Yeah, this is an unfortunate workaround for IE. At least Firefox gets it right. (Now, we just have to make Catalyst::Request::REST do the right thing;-)
Check out RT bug #23772. The right solution to this is to let the server decide which of the highest-weighted Accept:'ed content-types to send.
Of course IE breaks this by not even stating that it accepts text/html, but this is definitely not a Firefox bug.
And Firefox 3.0's Accept headers look really sexeh to me. Definitive improvement. ^^