You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

whatwg-fetch

Package Overview
Dependencies
Maintainers
3
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.2.0 to 3.3.0

47

dist/fetch.umd.js

@@ -5,8 +5,6 @@ (function (global, factory) {

(factory((global.WHATWGFetch = {})));
}(this, (function (exports) {
}(this, (function (exports) { 'use strict';
var global = (function(self) {
return self
// eslint-disable-next-line no-invalid-this
})(typeof self !== 'undefined' ? self : this);
var global = (typeof self !== 'undefined' && self) || (typeof global !== 'undefined' && global);
var support = {

@@ -286,3 +284,16 @@ searchParams: 'URLSearchParams' in global,

if (this._bodyArrayBuffer) {
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
var consumed = consumed(this);
if (consumed) {
return consumed
}
if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
return Promise.resolve(
this._bodyArrayBuffer.buffer.slice(
this._bodyArrayBuffer.byteOffset,
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
)
)
} else {
return Promise.resolve(this._bodyArrayBuffer)
}
} else {

@@ -333,2 +344,6 @@ return this.blob().then(readBlobAsArrayBuffer)

function Request(input, options) {
if (!(this instanceof Request)) {
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
}
options = options || {};

@@ -426,2 +441,5 @@ var body = options.body;

function Response(bodyInit, options) {
if (!(this instanceof Response)) {
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
}
if (!options) {

@@ -468,4 +486,5 @@ options = {};

exports.DOMException = global.DOMException;
if (typeof exports.DOMException !== 'function') {
try {
new exports.DOMException();
} catch (err) {
exports.DOMException = function(message, name) {

@@ -554,5 +573,11 @@ this.message = message;

request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value);
});
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
});
} else {
request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value);
});
}

@@ -559,0 +584,0 @@ if (request.signal) {

@@ -1,5 +0,3 @@

var global = (function(self) {
return self
// eslint-disable-next-line no-invalid-this
})(typeof self !== 'undefined' ? self : this)
var global = (typeof self !== 'undefined' && self) || (typeof global !== 'undefined' && global)
var support = {

@@ -279,3 +277,16 @@ searchParams: 'URLSearchParams' in global,

if (this._bodyArrayBuffer) {
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
var consumed = consumed(this);
if (consumed) {
return consumed
}
if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
return Promise.resolve(
this._bodyArrayBuffer.buffer.slice(
this._bodyArrayBuffer.byteOffset,
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
)
)
} else {
return Promise.resolve(this._bodyArrayBuffer)
}
} else {

@@ -326,2 +337,6 @@ return this.blob().then(readBlobAsArrayBuffer)

export function Request(input, options) {
if (!(this instanceof Request)) {
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
}
options = options || {}

@@ -419,2 +434,5 @@ var body = options.body

export function Response(bodyInit, options) {
if (!(this instanceof Response)) {
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
}
if (!options) {

@@ -461,4 +479,5 @@ options = {}

export var DOMException = global.DOMException
if (typeof DOMException !== 'function') {
try {
new DOMException()
} catch (err) {
DOMException = function(message, name) {

@@ -547,5 +566,11 @@ this.message = message

request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value)
})
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
xhr.setRequestHeader(name, normalizeValue(init.headers[name]))
})
} else {
request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value)
})
}

@@ -552,0 +577,0 @@ if (request.signal) {

{
"name": "whatwg-fetch",
"description": "A window.fetch polyfill.",
"version": "3.2.0",
"version": "3.3.0",
"main": "./dist/fetch.umd.js",

@@ -6,0 +6,0 @@ "module": "./fetch.js",

@@ -34,2 +34,4 @@ # window.fetch polyfill

an old version of a browser that doesn't support `window.fetch` natively.
Make sure you read this _entire_ readme, especially the [Caveats](#caveats)
section, as there's probably a known work-around for an issue you've found.
This project is a _polyfill_, and since all modern browsers now implement the

@@ -196,2 +198,4 @@ `fetch` function natively, **no code from this project** actually takes any

[`cache`](https://github.github.io/fetch/#caveats) directives are ignored.
* `keepalive` is not supported because it would involve making a synchronous XHR, which is something this project is not willing to do. See [issue #700](https://github.com/github/fetch/issues/700#issuecomment-484188326) for more information.

@@ -308,7 +312,7 @@ #### Handling HTTP error statuses

AbortController or AbortSignal. Consequently, you will need to include
[an additional polyfill](https://github.com/mo/abortcontroller-polyfill#readme)
[an additional polyfill](https://www.npmjs.com/package/yet-another-abortcontroller-polyfill)
for these APIs to abort fetches:
```js
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
import 'yet-another-abortcontroller-polyfill'
import {fetch} from 'whatwg-fetch'

@@ -315,0 +319,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc