xhr-status
Normalize the XHR status codes across various of environments. This eliminates all the odd browser bugs that you might run in to while working with XHR requests in browsers:
- Captures thrown errors when accessing
statusText
- Normalizes the
1233
status code in Internet Explorer for204
content. - Normalizes the
0
status code to200
forfile://
requests.
Installation
The module is released in the public npm registry and can be installed by running:
npm install --save xhr-status
Usage
This module exports a single function. The returned function accepts one single
argument which is a reference to the xhr
instance that you've created. It will
return an object with the following keys:
- code The XHR status code.
- text The XHR status text.
See for an implementation example:
'use strict'; var xhrstatus = xhr = xhr;xhr { var status = ; console // 204 console // OK}; xhr;
License
MIT