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

@whatwg-node/node-fetch

Package Overview
Dependencies
Maintainers
0
Versions
509
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@whatwg-node/node-fetch - npm Package Compare versions

Comparing version 0.5.20 to 0.5.21-alpha-20240805010752-0091eb73bd34a7b9e242a22352afacb8ac728cb7

24

cjs/Body.js

@@ -52,2 +52,26 @@ "use strict";

}
handleContentLengthHeader(forceSet = false) {
const contentTypeInHeaders = this.headers.get('content-type');
if (!contentTypeInHeaders) {
if (this.contentType) {
this.headers.set('content-type', this.contentType);
}
}
else {
this.contentType = contentTypeInHeaders;
}
const contentLengthInHeaders = this.headers.get('content-length');
if (forceSet && this.bodyInit == null && !contentLengthInHeaders) {
this.contentLength = 0;
this.headers.set('content-length', '0');
}
if (!contentLengthInHeaders) {
if (this.contentLength) {
this.headers.set('content-length', this.contentLength.toString());
}
}
else {
this.contentLength = parseInt(contentLengthInHeaders, 10);
}
}
get body() {

@@ -54,0 +78,0 @@ const _body = this.generateBody();

23

cjs/Request.js

@@ -55,24 +55,3 @@ "use strict";

if (this.method !== 'GET' && this.method !== 'HEAD') {
const contentTypeInHeaders = this.headers.get('content-type');
if (!contentTypeInHeaders) {
if (this.contentType) {
this.headers.set('content-type', this.contentType);
}
}
else {
this.contentType = contentTypeInHeaders;
}
const contentLengthInHeaders = this.headers.get('content-length');
if (bodyInit == null && !contentLengthInHeaders) {
this.contentLength = 0;
this.headers.set('content-length', '0');
}
if (!contentLengthInHeaders) {
if (this.contentLength) {
this.headers.set('content-length', this.contentLength.toString());
}
}
else {
this.contentLength = parseInt(contentLengthInHeaders, 10);
}
this.handleContentLengthHeader(true);
}

@@ -79,0 +58,0 @@ if (requestInit?.agent != null) {

@@ -21,20 +21,3 @@ "use strict";

this.type = init?.type || 'default';
const contentTypeInHeaders = this.headers.get('content-type');
if (!contentTypeInHeaders) {
if (this.contentType) {
this.headers.set('content-type', this.contentType);
}
}
else {
this.contentType = contentTypeInHeaders;
}
const contentLengthInHeaders = this.headers.get('content-length');
if (!contentLengthInHeaders) {
if (this.contentLength) {
this.headers.set('content-length', this.contentLength.toString());
}
}
else {
this.contentLength = parseInt(contentLengthInHeaders, 10);
}
this.handleContentLengthHeader();
}

@@ -41,0 +24,0 @@ get ok() {

@@ -48,2 +48,26 @@ import { Readable } from 'stream';

}
handleContentLengthHeader(forceSet = false) {
const contentTypeInHeaders = this.headers.get('content-type');
if (!contentTypeInHeaders) {
if (this.contentType) {
this.headers.set('content-type', this.contentType);
}
}
else {
this.contentType = contentTypeInHeaders;
}
const contentLengthInHeaders = this.headers.get('content-length');
if (forceSet && this.bodyInit == null && !contentLengthInHeaders) {
this.contentLength = 0;
this.headers.set('content-length', '0');
}
if (!contentLengthInHeaders) {
if (this.contentLength) {
this.headers.set('content-length', this.contentLength.toString());
}
}
else {
this.contentLength = parseInt(contentLengthInHeaders, 10);
}
}
get body() {

@@ -50,0 +74,0 @@ const _body = this.generateBody();

@@ -52,24 +52,3 @@ import { Agent as HTTPAgent, globalAgent as httpGlobalAgent } from 'http';

if (this.method !== 'GET' && this.method !== 'HEAD') {
const contentTypeInHeaders = this.headers.get('content-type');
if (!contentTypeInHeaders) {
if (this.contentType) {
this.headers.set('content-type', this.contentType);
}
}
else {
this.contentType = contentTypeInHeaders;
}
const contentLengthInHeaders = this.headers.get('content-length');
if (bodyInit == null && !contentLengthInHeaders) {
this.contentLength = 0;
this.headers.set('content-length', '0');
}
if (!contentLengthInHeaders) {
if (this.contentLength) {
this.headers.set('content-length', this.contentLength.toString());
}
}
else {
this.contentLength = parseInt(contentLengthInHeaders, 10);
}
this.handleContentLengthHeader(true);
}

@@ -76,0 +55,0 @@ if (requestInit?.agent != null) {

@@ -18,20 +18,3 @@ import { STATUS_CODES } from 'http';

this.type = init?.type || 'default';
const contentTypeInHeaders = this.headers.get('content-type');
if (!contentTypeInHeaders) {
if (this.contentType) {
this.headers.set('content-type', this.contentType);
}
}
else {
this.contentType = contentTypeInHeaders;
}
const contentLengthInHeaders = this.headers.get('content-length');
if (!contentLengthInHeaders) {
if (this.contentLength) {
this.headers.set('content-length', this.contentLength.toString());
}
}
else {
this.contentLength = parseInt(contentLengthInHeaders, 10);
}
this.handleContentLengthHeader();
}

@@ -38,0 +21,0 @@ get ok() {

{
"name": "@whatwg-node/node-fetch",
"version": "0.5.20",
"version": "0.5.21-alpha-20240805010752-0091eb73bd34a7b9e242a22352afacb8ac728cb7",
"description": "Fetch API implementation for Node",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -30,2 +30,5 @@ import { Readable } from 'stream';

private generateBody;
protected handleContentLengthHeader(this: PonyfillBody & {
headers: Headers;
}, forceSet?: boolean): void;
get body(): PonyfillReadableStream<Uint8Array> | null;

@@ -32,0 +35,0 @@ _chunks: Uint8Array[] | null;

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