fetcho: a useful fetch tiny wrapper
Usage: like fetch, it prefills headers
opts for convenience, and body
is automatically JSON.stringified
;// or const fetcho = require('fetcho');
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