@magicdawn/rp

0.1.0 • Public • Published

rp

lightweight promise api for request

Build Status Coverage Status npm version npm downloads npm license

Install

npm i @magicdawn/rp --save

API

const rp = require('@magicdawn/rp')

rp()

rp(options)
  .then(([res, body]) => {
    /* blabla */
  })
  .catch(err => {
    /* blabla */
  })

rp.<http-verb>()

rp.get(url, options)
  .then(([res, body]) => {
    /* blabla */
  })
  .catch(err => {
    /* blabla */
  })

rp.createFrom(request)

  • create a rp instance from a request instance
  • the request instance can be require('request') or require('request').defaults()

rp.defaults(options)

same as rp.createFrom(request.defaults(options))

Changelog

CHANGELOG.md

License

the MIT License http://magicdawn.mit-license.org

Package Sidebar

Install

npm i @magicdawn/rp

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

4.76 kB

Total Files

5

Last publish

Collaborators

  • magicdawn