ptth

1.0.10 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i ptth

Weekly Downloads

0

Version

1.0.10

License

ISC

Last publish

Collaborators

  • ergusto