xttp

1.0.5 • Public • Published

xttp xttp

simple http client in node js

Installation

$ npm install xttp

Example

const xttp = require('xttp');
 
// case 1:
xttp('https://api.github.com/users/song940/orgs', {
  method: 'get',
  headers: {
    'User-Agent': 'xttp/1.0'
  }
})
.then(res => res.json())
.then(res => {
  console.log(res);
});
 
// case 2:
xttp('https://api.github.com/users/song940/orgs', {
  method: 'get',  
  headers: {
    'User-Agent': 'xttp/1.0'
  }
}, async (err, res) => {
  const data = await res.json();
  console.log(err, data);
});
 
// case 3:
xttp
.create()
.post('https://httpbin.org/post?a=b')
.query({ c: 'd' })
.then(res => res.json())
.then(res => console.log(res));
 
// case 4:
xttp
.get('https://httpbin.org/get?a=b')
.then(res => res.json())
.then(res => console.log(res));
 
 

Contributing

  • Fork this Repo first
  • Clone your Repo
  • Install dependencies by $ npm install
  • Checkout a feature branch
  • Feel free to add your features
  • Make sure your features are fully tested
  • Publish your local branch, Open a pull request
  • Enjoy hacking <3

MIT

This work is licensed under the MIT license.


Readme

Keywords

Package Sidebar

Install

npm i xttp

Weekly Downloads

17

Version

1.0.5

License

MIT

Unpacked Size

11.6 kB

Total Files

7

Last publish

Collaborators

  • song940