New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@glomex/custom-fetch

Package Overview
Dependencies
Maintainers
12
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glomex/custom-fetch

A convenience wrapper for fetch, which can be used in node and in the browser.

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
432
increased by51.05%
Maintainers
12
Weekly downloads
 
Created
Source

@glomex/custom-fetch

A convenience wrapper for fetch, which can be used in node and in the browser.

It handles the following things:

  • Automatically assumes that Content-Type': application/json is used (encodes body with JSON.stringify and automatically resolves the response with .json())
  • Allows to pass a timeout

Usage

Node

It ensures to load node-fetch and abort-controller as necessary.

const fetch = require('@glomex/custom-fetch');
fetch(
  'https://my-endpoint',
  // also see https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters
  { method: 'GET' },
  { timeout: 5000 }
);
Browser
import fetch from 'https://unpkg.com/@glomex/custom-fetch@1/dist/custom-fetch.modern.js';
fetch(
  'https://my-endpoint',
  // also see https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters
  { method: 'GET' },
  { timeout: 5000, responseType: 'text' }
);

License

Apache 2.0 License

FAQs

Package last updated on 01 Dec 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc