0.1.0 • Published 7 years ago

nofetch v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

nofetch

NPM version NPM downloads Build Status donate

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

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. 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