1.3.3 • Published 3 years ago
helper-xhr v1.3.3
Helper XHR
Very basic, very simple, xhr promise wrapper. I started using fetch, and soon discovered "replay xhr" is not supported in browsers for fetch request.
So I created this miny/simple/basic xhr request wrapper.
Installation
npm install helper-xhr
There's no dependecy.
Yes it's in ES6.
Usage
import HttpRequest from 'helper-xhr';
var xhr = new HttpRequest("POST", "/foo/bar/", "application/json");
xhr.send({elmer: "fudd"}).then((data) => {
console.log("got this", data.json);
}).catch((e) => {
console.log("something wrong", e);
});
console.log("headers", xhr.getAllResponseHeaders());
Contributing
You are welcome!
History
Created on March 22, 2017
Credits
Don't blame me.
License
Do whatever you want with it.