0.1.0 • Published 7 years ago
nofetch v0.1.0
nofetch
Install
yarn add nofetch
Usage
const nofetch = require('nofetch')
// GET
nofetch('/url')
.then(res => res.json())
// POST
nofetch('/url', {method: 'post', body: {a: 1}})
.then(res => res.json())
// Form data
const form = new FormData()
form.append('a', 1)
nofetch('/url', {method: 'post', body: form})
.then(res => res.json())
API
nofetch(url, options)
options
method:
Type: string
Default: GET
Request method.
headers
Type: object
Request headers.
body
Request body. can be a string, object, buffer, readable stream
timeout
Type: number
object
Request timeout.
agent
agent
option for http.request
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
nofetch © egoist, Released under the MIT License. Authored and maintained by egoist with help from contributors (list).
egoistian.com · GitHub @egoist · Twitter @rem_rin_rin
0.1.0
7 years ago