Closed kjk closed 8 years ago
Thanks for the report. req.status || statusCode
is supposed to catch req.status == undefined
, not req.status === 0
. I'll patch it to req.status === undefined ? statusCode : req.status
So this is patched in 82459292c72fba0838f46a5fed1c1274497309ed. Released as v0.4.1
.
Note that nanoajax doesn't do much for you in this case, still giving you a callback with cb(0, "", req)
. Like other errors in nanoajax, the callback can check the falsyness of the status code.
Thanks, that will work for my use case.
@kjk I was thinking about this again, and realized that nanoajax could call back with (0, "Error")
instead of (0, "")
, so thats now what happens in v0.4.3
.
@yanatan16 sounds like a good idea, thanks!
This is Chrome 47.0.2526.106 (64-bit) on Mac.
When testing locally and when the server is not running, a request callback has code = 200 and empty responseText.
This issue is here:
In my case
req.status
is 0 but is converted to 200 (statusCode
) because it's called from:if (req.readyState === 4) success()
. In console I see 'net::ERR_CONNECTION_REFUSED' error.Not sure what cases are where req.status 0 should be converted to something else. It seems to me this should be reported as error i.e. req.status should be passed as is to the callback.