View Full Version : null response parameter for proxy exception for a HTTP 401 Unauthorized

13 Nov 2013, 4:38 PM

ExtJS v4.1.3

I have a Store that's retrieving data via JSONP. However, if I don't pass in a valid authorization code, the remote service, correctly, returns an HTTP 401 Unauthorized. Though there are other cases like a 403 Forbidden (if I make too many requests, even with a valid authorization code).

Though I can catch the proxy exception, I'm getting a null response object (2nd parameter), which means I can't check the status to see if it was a 401, a 403 or something else.

I have tested the remote service via the browser, and it is returned the correct HTTP status code. The issue is that my ExtJS code can't seem to get that HTTP status code.

Any suggestions?



14 Nov 2013, 5:16 PM
I could be mistaken but I wasn't aware that it was possible to access the status code when using JSON-P (and I'm not referring specifically to ExtJS here). In that case it is better for the server to return a 200 code and use a success property to communicate the error, with other properties containing relevant details.

16 Nov 2013, 2:01 PM
Yes, I believe you're right.

It's a major bummer, and I wished I'd remembered this...would have saved me a lot of debugging.