@whatwg-node/node-fetch 0.4.13-alpha-20230821124424-6f3a2b1 → 0.4.13-alpha-20230821132128-700c49e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/Body.js CHANGED
@@ -158,7 +158,7 @@ class PonyfillBody {
158
158
  reject(new Error(`File size limit exceeded: ${formDataLimits?.fileSize} bytes`));
159
159
  });
160
160
  fileStream.on('data', chunk => {
161
- chunks.push(Buffer.from(chunk));
161
+ chunks.push(chunk);
162
162
  });
163
163
  fileStream.on('close', () => {
164
164
  if (fileStream.truncated) {
@@ -306,6 +306,7 @@ function processBodyInit(bodyInit) {
306
306
  }
307
307
  if (isBlob(bodyInit)) {
308
308
  return {
309
+ bodyType: BodyInitType.Blob,
309
310
  contentType: bodyInit.type,
310
311
  contentLength: bodyInit.size,
311
312
  bodyFactory() {
@@ -331,6 +332,7 @@ function processBodyInit(bodyInit) {
331
332
  const boundary = Math.random().toString(36).substr(2);
332
333
  const contentType = `multipart/form-data; boundary=${boundary}`;
333
334
  return {
335
+ bodyType: BodyInitType.FormData,
334
336
  contentType,
335
337
  contentLength: null,
336
338
  bodyFactory() {
package/cjs/FormData.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getStreamFromFormData = exports.PonyfillFormData = void 0;
4
- const File_js_1 = require("./File.js");
5
4
  const ReadableStream_js_1 = require("./ReadableStream.js");
6
5
  class PonyfillFormData {
7
6
  constructor() {
@@ -118,17 +117,9 @@ function getStreamFromFormData(formData, boundary = '---') {
118
117
  }
119
118
  exports.getStreamFromFormData = getStreamFromFormData;
120
119
  function getNormalizedFile(name, blob, fileName) {
121
- if (blob instanceof File_js_1.PonyfillFile) {
122
- if (fileName != null) {
123
- return new File_js_1.PonyfillFile([blob], fileName, {
124
- type: blob.type,
125
- lastModified: blob.lastModified,
126
- });
127
- }
128
- return blob;
129
- }
130
- return new File_js_1.PonyfillFile([blob], fileName || name, { type: blob.type });
120
+ blob.name = fileName || blob.name || name;
121
+ return blob;
131
122
  }
132
123
  function isBlob(value) {
133
- return value != null && typeof value === 'object' && typeof value.arrayBuffer === 'function';
124
+ return value?.arrayBuffer != null;
134
125
  }
package/esm/Body.js CHANGED
@@ -154,7 +154,7 @@ export class PonyfillBody {
154
154
  reject(new Error(`File size limit exceeded: ${formDataLimits?.fileSize} bytes`));
155
155
  });
156
156
  fileStream.on('data', chunk => {
157
- chunks.push(Buffer.from(chunk));
157
+ chunks.push(chunk);
158
158
  });
159
159
  fileStream.on('close', () => {
160
160
  if (fileStream.truncated) {
@@ -301,6 +301,7 @@ function processBodyInit(bodyInit) {
301
301
  }
302
302
  if (isBlob(bodyInit)) {
303
303
  return {
304
+ bodyType: BodyInitType.Blob,
304
305
  contentType: bodyInit.type,
305
306
  contentLength: bodyInit.size,
306
307
  bodyFactory() {
@@ -326,6 +327,7 @@ function processBodyInit(bodyInit) {
326
327
  const boundary = Math.random().toString(36).substr(2);
327
328
  const contentType = `multipart/form-data; boundary=${boundary}`;
328
329
  return {
330
+ bodyType: BodyInitType.FormData,
329
331
  contentType,
330
332
  contentLength: null,
331
333
  bodyFactory() {
package/esm/FormData.js CHANGED
@@ -1,4 +1,3 @@
1
- import { PonyfillFile } from './File.js';
2
1
  import { PonyfillReadableStream } from './ReadableStream.js';
3
2
  export class PonyfillFormData {
4
3
  constructor() {
@@ -113,17 +112,9 @@ export function getStreamFromFormData(formData, boundary = '---') {
113
112
  });
114
113
  }
115
114
  function getNormalizedFile(name, blob, fileName) {
116
- if (blob instanceof PonyfillFile) {
117
- if (fileName != null) {
118
- return new PonyfillFile([blob], fileName, {
119
- type: blob.type,
120
- lastModified: blob.lastModified,
121
- });
122
- }
123
- return blob;
124
- }
125
- return new PonyfillFile([blob], fileName || name, { type: blob.type });
115
+ blob.name = fileName || blob.name || name;
116
+ return blob;
126
117
  }
127
118
  function isBlob(value) {
128
- return value != null && typeof value === 'object' && typeof value.arrayBuffer === 'function';
119
+ return value?.arrayBuffer != null;
129
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.4.13-alpha-20230821124424-6f3a2b1",
3
+ "version": "0.4.13-alpha-20230821132128-700c49e",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {