0.1.0 • Published 5 years ago

@magicdawn/rp v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

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