This package has been deprecated

Author message:

replaced by fetchu

fetcho

1.2.3 • Public • Published

fetcho: a useful fetch tiny wrapper

npm version build status coverage status

Usage: like fetch, it prefills headers opts for convenience, and body is automatically JSON.stringified

import fetcho from 'fetcho';
// or const fetcho = require('fetcho');
 
fetcho('https://httpbin.org/get?test=foo')
    .then(console.log)
 
fetcho('https://httpbin.org/post', {method: 'POST', body: {test: 'foo'}})
    .then(console.log)

How does it compare to axios?

  • it uses window.fetch in browser (polyfill it if needed, with polyfill.io for example), node-fetch + fetch-cookie
  • Supports the Promise API: yes of course, like fetch
  • Intercept request and response: no, just wrap it yourself
  • Transform request and response data: no, same answer
  • Cancel requests: use AbortController (polyfill.io might have it soon, or use the suggested polyfills https://github.com/Financial-Times/polyfill-service/issues/1722) Automatic transforms for JSON data
  • Client side support for protecting against XSRF: no

Readme

Keywords

Package Sidebar

Install

npm i fetcho

Weekly Downloads

0

Version

1.2.3

License

ISC

Unpacked Size

7 kB

Total Files

8

Last publish

Collaborators

  • caub