Monday, January 18, 2010

Firefox, why don't you parse error messages?

My JSON webservice uses HTTP Status codes.

I know it's a novel idea to use internationally agreed upon standards (and hardly anyone does it...) but come on Firefox! WTF!? I thought standards are what you were all about!?

I send a bad password via xhr and my webservice responds 422 Unprocessable Entity with JSON which describes the error in greater detail.

Firefox turns that response into an empty string!!! But if the status code is 2xx it works fine. Huh? What? Huh?

jQuery 1.4 is set up to parse using window.JSON and As it turns out an empty string isn't proper JSON and an exception is thrown. WebApp go BOOM!

I'd like to submit a bug to Mozilla, but I have to wait for their mail system to get through to mine... and hence I decided to blog about it.


In the meantime... I guess I lie and use 200 status codes? I don't know. That seems to be the simplest solution.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home