Socket
Socket
Sign inDemoInstall

node-fetch

Package Overview
Dependencies
5
Maintainers
5
Versions
96
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.2.10 to 3.3.0

1

@types/index.d.ts

@@ -199,2 +199,3 @@ /// <reference types="node" />

static redirect(url: string, status?: number): Response;
static json(data: any, init?: ResponseInit): Response;
}

@@ -201,0 +202,0 @@

2

package.json
{
"name": "node-fetch",
"version": "3.2.10",
"version": "3.3.0",
"description": "A light-weight module that brings Fetch API to node.js",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -272,4 +272,4 @@ <div align="center">

class HTTPResponseError extends Error {
constructor(response, ...args) {
super(`HTTP Error Response: ${response.status} ${response.statusText}`, ...args);
constructor(response) {
super(`HTTP Error Response: ${response.status} ${response.statusText}`);
this.response = response;

@@ -404,3 +404,3 @@ }

```js
import fetch {
import fetch, {
Blob,

@@ -407,0 +407,0 @@ blobFrom,

@@ -127,2 +127,21 @@ /**

static json(data = undefined, init = {}) {
const body = JSON.stringify(data);
if (body === undefined) {
throw new TypeError('data is not JSON serializable');
}
const headers = new Headers(init && init.headers);
if (!headers.has('content-type')) {
headers.set('content-type', 'application/json');
}
return new Response(body, {
...init,
headers
});
}
get [Symbol.toStringTag]() {

@@ -129,0 +148,0 @@ return 'Response';

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc