Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@titelmedia/node-fetch

Package Overview
Dependencies
Maintainers
8
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@titelmedia/node-fetch - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

54

lib/index.es.js

@@ -6,3 +6,3 @@ process.emitWarning("The .es.js file is deprecated. Use .mjs instead.");

import http, { STATUS_CODES } from 'http';
import { format, parse, resolve } from 'url';
import { parse, format, resolve } from 'url';
import https from 'https';

@@ -815,2 +815,8 @@ import zlib from 'zlib';

function checkGuard(obj) {
if (obj._guard === 'immutable') {
throw new TypeError("Cannot modify header. Immutable guard is set.");
}
}
/**

@@ -840,2 +846,3 @@ * Find the key in the map object given a header name.

* @param Object headers Response headers
* @param Object options
* @return Void

@@ -845,2 +852,3 @@ */

let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;

@@ -897,2 +905,13 @@ this[MAP] = Object.create(null);

}
if (options == null) ; else if (typeof options === 'object') {
if (options.guard) {
// @TODO validate values for guard
this._guard = options.guard;
} else {
this._guard = 'none';
}
} else {
throw new TypeError('Provided options must be an object');
}
}

@@ -948,2 +967,4 @@

set(name, value) {
checkGuard(this);
name = `${name}`;

@@ -965,2 +986,4 @@ value = `${value}`;

append(name, value) {
checkGuard(this);
name = `${name}`;

@@ -997,2 +1020,4 @@ value = `${value}`;

delete(name) {
checkGuard(this);
name = `${name}`;

@@ -1245,2 +1270,29 @@ validateName(name);

}
static redirect(url, status) {
//1. Let parsedURL be the result of parsing url with current settings object’s API base URL.
//2. If parsedURL is failure, then throw a TypeError.
const parsedURL = parse(url);
//3. If status is not a redirect status, then throw a RangeError.
let intStatus = parseInt(status, 10); if (intStatus < 300 || intStatus > 399) {
throw new RangeError('Not a redirect status');
}
//4. Let r be a new Response object, whose response is a new response.
//5. Set r’s headers to a new Headers object whose guard is "immutable".
//6. Set r’s response’s status to status.
//7. Append `Location` to parsedURL, serialized and isomorphic encoded, in r’s response’s header list.
const r = new Response(new Body(""), {
url,
status: intStatus,
name: `redirected(${url})`,
headers: new Headers({
Location: url
}, { guard: 'immutable' })
});
//8. Return r.
return r;
}
}

@@ -1247,0 +1299,0 @@

@@ -820,2 +820,8 @@ 'use strict';

function checkGuard(obj) {
if (obj._guard === 'immutable') {
throw new TypeError("Cannot modify header. Immutable guard is set.");
}
}
/**

@@ -845,2 +851,3 @@ * Find the key in the map object given a header name.

* @param Object headers Response headers
* @param Object options
* @return Void

@@ -850,2 +857,3 @@ */

let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;

@@ -902,2 +910,13 @@ this[MAP] = Object.create(null);

}
if (options == null) ; else if (typeof options === 'object') {
if (options.guard) {
// @TODO validate values for guard
this._guard = options.guard;
} else {
this._guard = 'none';
}
} else {
throw new TypeError('Provided options must be an object');
}
}

@@ -953,2 +972,4 @@

set(name, value) {
checkGuard(this);
name = `${name}`;

@@ -970,2 +991,4 @@ value = `${value}`;

append(name, value) {
checkGuard(this);
name = `${name}`;

@@ -1002,2 +1025,4 @@ value = `${value}`;

delete(name) {
checkGuard(this);
name = `${name}`;

@@ -1250,2 +1275,29 @@ validateName(name);

}
static redirect(url$$1, status) {
//1. Let parsedURL be the result of parsing url with current settings object’s API base URL.
//2. If parsedURL is failure, then throw a TypeError.
const parsedURL = url.parse(url$$1);
//3. If status is not a redirect status, then throw a RangeError.
let intStatus = parseInt(status, 10); if (intStatus < 300 || intStatus > 399) {
throw new RangeError('Not a redirect status');
}
//4. Let r be a new Response object, whose response is a new response.
//5. Set r’s headers to a new Headers object whose guard is "immutable".
//6. Set r’s response’s status to status.
//7. Append `Location` to parsedURL, serialized and isomorphic encoded, in r’s response’s header list.
const r = new Response(new Body(""), {
url: url$$1,
status: intStatus,
name: `redirected(${url$$1})`,
headers: new Headers({
Location: url$$1
}, { guard: 'immutable' })
});
//8. Return r.
return r;
}
}

@@ -1252,0 +1304,0 @@

3

package.json
{
"name": "@titelmedia/node-fetch",
"version": "3.0.1",
"private": false,
"version": "3.1.0",
"description": "A light-weight module that brings the Fetch API to node.js; Forked from https://npm.im/node-fetch",

@@ -6,0 +5,0 @@ "main": "lib/index",

Sorry, the diff of this file is not supported yet

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