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

sane-fetch

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sane-fetch

A sane fetch wrapper.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

sane-fetch

Build status Git tag NPM version Code style

A sane fetch wrapper - deserialized body and better error handling.

Installation

$ npm install sane-fetch

Usage

import fetch from 'sane-fetch'

fetch('https://www.google.com').then((res) => res)
// =>
// {
//  url: https://www.google.com,
//  status: 200,
//  statusText: 'OK',
//  headers: ...,
//  body: ...
// }

API

fetch(url, params)

  • url - url to fetch
  • params - parameters of fetch

Returns: promise that resolves response

response

  • url - The url of the endpoint you requested (as returned by the request)
  • status - The numerical status code of the response (e.g. 200)
  • statusText - The text version of the status (e.g. 'OK')
  • headers - A Headers object
  • body - The deserialized response body. This may be an object, string, or buffer, depending on the type of response.

License

MIT

FAQs

Package last updated on 04 Feb 2016

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