New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fetcho

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetcho

JSON fetch wrapper

latest
Source
npmnpm
Version
1.2.3
Version published
Maintainers
1
Created
Source

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

Keywords

fetch

FAQs

Package last updated on 20 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts