ptth
v1.0.10
Published
A simple http client with middleware for the browser
Downloads
4
Readme
ptth
A simple http client with middleware for the browser
Installation
npm install --save ptth
Or grab the script from the build folder.
Code Example
ptth.use(function(res, next) {
console.log(res.status);
next();
});
ptth('http://swapi.co/api/starships')
.header('content-type', 'application/json')
.params('page', '2')
.data({ 'form': 'data' })
.post(function(res) {
if (res.ok) {
console.log(res.body);
}
});
// logs response status code and body of the response
API Reference
See the docs.
License
MIT