plato-request

0.1.4 • Public • Published

PLATO-REQUEST

🚦 A Request Library based on the Fetch API

Travis Coveralls dependencies devDependency Status NPM version

Change Log

0.1.0

  • support a mutate that return a none-promise value

Usage

basic

import request from 'plato-request'

request({
  method: 'GET', // defaults
  url: 'https://.../{user}/{repo}/commits',
  params: {
    user: 'crossjs',
    repo: 'plato'
  },
  query: {
    per_page: 3
  }
  headers: {
    'Accept': 'application/vnd.github.v3+json'
  }
})

use mutate

// asynchronously with promise
request({
  ...,
  mutate (options) {
    return new Promise(function (resolve, reject) {
      // do something,
      // like computing Authorization asynchronously
      resolve(options)
    })
  }
})

// synchronously, new in 0.1.0
request({
  ...,
  mutate (options) {
    // do something,
    // like computing Authorization synchronously
    return options
  }
})

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.40latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.40
0.1.30
0.1.20
0.1.10
0.1.00
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i plato-request

Weekly Downloads

0

Version

0.1.4

License

MIT

Last publish

Collaborators

  • imliwenfu
  • lmm0591