1.2.3 • Published 7 years ago

fetcho v1.2.3

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

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
1.2.3

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago