Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 8, 2024 via pnpm

whatwg-fetch 3.6.20

A window.fetch polyfill.
Package summary
Share
0
issues
1
license
1
MIT
Package created
12 Jan 2015
Version published
13 Dec 2023
Maintainers
3
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
whatwg-fetch@3.6.20
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of whatwg-fetch 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does whatwg-fetch do?

Whatwg-fetch is a JavaScript package that provides the fetch function as a Promise-based mechanism for making web requests in the browser. It is a polyfill that implements a subset of the standard Fetch specification. It serves as a viable replacement for most uses of XMLHttpRequest in traditional web applications. However, it's worth noting that this package is for web browser use only and does not work in Node.js environments.

How do you use whatwg-fetch?

To use whatwg-fetch, you need to install the package using npm, then import it into your script where you want to leverage the fetch functionality. You can do this by running npm install whatwg-fetch --save and then in your script file use import 'whatwg-fetch'. Here is an example of how you can use the fetch function after importing the whatwg-fetch:

import 'whatwg-fetch'

fetch('/users.json')
  .then(response => response.json())
  .then(json => console.log('parsed json', json))
  .catch(ex => console.log('parsing failed', ex))

In the above example, a fetch request is made to a JSON file, the response is converted to JSON, and then logged to the console. If the JSON fails to parse or the request fails due to network issues, an exception is caught and logged to the console.

It's important to note that fetch won't reject on HTTP error status, so handling for this scenario will need to be implemented manually.

Where are the whatwg-fetch docs?

The whatwg-fetch package documentation can be found directly in the package README file on the GitHub repository, which has the URL git+https://github.com/github/fetch.git. The documentation provides detailed explanation on how to use the package, including how to handle errors and caution points to be aware of.