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
1
Versions
554
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.0.1-alpha-20221225173053-f9310f6 to 0.0.1-alpha-20221225175918-b8ec28d

5

Body.d.ts

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

bodyUsed: boolean;
readonly body: PonyfillReadableStream<Uint8Array> | null;
contentType: string | null;

@@ -15,6 +16,2 @@ contentLength: number | null;

private bodyType?;
private _bodyProcessed;
private _processedBody;
get body(): PonyfillReadableStream<Uint8Array> | null;
private processBody;
arrayBuffer(): Promise<ArrayBuffer>;

@@ -21,0 +18,0 @@ blob(): Promise<PonyfillBlob>;

2

Headers.d.ts

@@ -11,2 +11,4 @@ export type PonyfillHeadersInit = [string, string][] | Record<string, string | string[] | undefined> | Headers;

forEach(callback: (value: string, key: string, parent: Headers) => void): void;
entries(): IterableIterator<[string, string]>;
[Symbol.iterator](): IterableIterator<[string, string]>;
}

@@ -279,19 +279,9 @@ 'use strict';

this.bodyUsed = false;
this.body = null;
this.contentType = null;
this.contentLength = null;
this._bodyProcessed = false;
this._processedBody = null;
}
get body() {
if (!this._bodyProcessed) {
this._processedBody = this.processBody();
this._bodyProcessed = true;
}
return this._processedBody;
}
processBody() {
if (this.bodyInit == null) {
return null;
this.body = null;
}
if (typeof this.bodyInit === 'string') {
else if (typeof this.bodyInit === 'string') {
this.bodyType = BodyInitType.String;

@@ -301,7 +291,7 @@ const buffer = Buffer.from(this.bodyInit);

this.contentLength = buffer.length;
return new PonyfillReadableStream(stream.Readable.from(buffer));
this.body = new PonyfillReadableStream(stream.Readable.from(buffer));
}
else if (this.bodyInit instanceof PonyfillReadableStream) {
this.bodyType = BodyInitType.ReadableStream;
return this.bodyInit;
this.body = this.bodyInit;
}

@@ -313,3 +303,3 @@ else if (this.bodyInit instanceof PonyfillBlob) {

this.contentLength = this.bodyInit.size;
return new PonyfillReadableStream(blobStream);
this.body = new PonyfillReadableStream(blobStream);
}

@@ -321,3 +311,3 @@ else if (this.bodyInit instanceof PonyfillFormData) {

this.contentType = `multipart/form-data; boundary=${boundary}`;
return new PonyfillReadableStream({
this.body = new PonyfillReadableStream({
start: async (controller) => {

@@ -357,3 +347,3 @@ controller.enqueue(Buffer.from(`--${boundary}\r\n`));

this.contentLength = this.bodyInit.byteLength;
return new PonyfillReadableStream(stream.Readable.from(this.bodyInit));
this.body = new PonyfillReadableStream(stream.Readable.from(this.bodyInit));
}

@@ -363,7 +353,7 @@ else if (this.bodyInit instanceof ArrayBuffer) {

this.contentLength = this.bodyInit.byteLength;
return new PonyfillReadableStream(stream.Readable.from(Buffer.from(this.bodyInit)));
this.body = new PonyfillReadableStream(stream.Readable.from(Buffer.from(this.bodyInit)));
}
else if (this.bodyInit instanceof stream.Readable) {
this.bodyType = BodyInitType.Readable;
return new PonyfillReadableStream(this.bodyInit);
this.body = new PonyfillReadableStream(this.bodyInit);
}

@@ -485,2 +475,8 @@ else {

}
entries() {
return this.map.entries();
}
[Symbol.iterator]() {
return this.map.entries();
}
}

@@ -512,3 +508,2 @@

super(bodyInit);
this.postProcessedBody = false;
this.destination = '';

@@ -533,11 +528,2 @@ this.priority = 'auto';

}
}
get body() {
const actualBody = super.body;
if (!this.postProcessedBody) {
this.postProcessBody();
}
return actualBody;
}
postProcessBody() {
if (!this.headers.has('content-type')) {

@@ -544,0 +530,0 @@ if (this.contentType) {

{
"name": "@whatwg-node/node-fetch",
"version": "0.0.1-alpha-20221225173053-f9310f6",
"version": "0.0.1-alpha-20221225175918-b8ec28d",
"description": "Fetch API implementation for Node",

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

@@ -9,5 +9,2 @@ import { PonyfillBody, BodyPonyfillInit } from './Body';

constructor(input: RequestInfo | URL, options?: RequestPonyfillInit);
get body(): import("./ReadableStream").PonyfillReadableStream<Uint8Array> | null;
private postProcessedBody;
private postProcessBody;
cache: RequestCache;

@@ -14,0 +11,0 @@ credentials: RequestCredentials;

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