RusticiSoftware/TinCanJS

Fake status on IE request causing problems

Closed this issue · 2 comments

In IE requests, when the XHR object is not populated, TinCanJS tries to pick a sensible error code to send through. the trouble is that for GETs which legitimately return 404 codes, TinCanJS assumes these should be 400. For application using TinCanJS will handle 400 and 404 very differently so this is a problem.

We've replaced the 400 with 404 in our copy of TinCanJS. Are there any problems with doing that and is there a better solution?

For the same reason as you state you won't detect actual errors. I recall thinking there was a way to detect this scenario, possibly by checking the response for content on a 400 to detect a 404. Making everything a 404 means you can't distinguish the success but not found vs. error case. You are certainly welcome to do so, but we can't in the library. Unfortunately I don't know that there is a way to code around incorrect browser behavior, it is just a consequence of having to support older IEs. I'll look into it a bit more, but not sure when so I wanted to post something back.

In our case, assuming 404 is better as at least the learning runs in IE. If there's a serious problem, we'll pick that up when making PUT and POST requests and if it really is a badly formed request, we should pick that up when testing other browsers.