@whatwg-node/node-fetch 0.0.2-alpha-20230202184428-e0c4cca → 0.0.2-alpha-20230202184911-724f9bd

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.
Files changed (3) hide show
  1. package/index.js +5 -5
  2. package/index.mjs +5 -5
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -296,7 +296,11 @@ class PonyfillFormData {
296
296
  const entry = entries.shift();
297
297
  if (entry) {
298
298
  const [key, value] = entry;
299
- if (value instanceof PonyfillBlob) {
299
+ if (typeof value === 'string') {
300
+ controller.enqueue(Buffer.from(`Content-Disposition: form-data; name="${key}"\r\n\r\n`));
301
+ controller.enqueue(Buffer.from(value));
302
+ }
303
+ else {
300
304
  let filenamePart = '';
301
305
  if (value.name) {
302
306
  filenamePart = `; filename="${value.name}"`;
@@ -305,10 +309,6 @@ class PonyfillFormData {
305
309
  controller.enqueue(Buffer.from(`Content-Type: ${value.type || 'application/octet-stream'}\r\n\r\n`));
306
310
  controller.enqueue(Buffer.from(await value.arrayBuffer()));
307
311
  }
308
- else {
309
- controller.enqueue(Buffer.from(`Content-Disposition: form-data; name="${key}"\r\n\r\n`));
310
- controller.enqueue(Buffer.from(value));
311
- }
312
312
  if (entries.length === 0) {
313
313
  controller.enqueue(Buffer.from(`\r\n--${boundary}--\r\n`));
314
314
  controller.close();
package/index.mjs CHANGED
@@ -290,7 +290,11 @@ class PonyfillFormData {
290
290
  const entry = entries.shift();
291
291
  if (entry) {
292
292
  const [key, value] = entry;
293
- if (value instanceof PonyfillBlob) {
293
+ if (typeof value === 'string') {
294
+ controller.enqueue(Buffer.from(`Content-Disposition: form-data; name="${key}"\r\n\r\n`));
295
+ controller.enqueue(Buffer.from(value));
296
+ }
297
+ else {
294
298
  let filenamePart = '';
295
299
  if (value.name) {
296
300
  filenamePart = `; filename="${value.name}"`;
@@ -299,10 +303,6 @@ class PonyfillFormData {
299
303
  controller.enqueue(Buffer.from(`Content-Type: ${value.type || 'application/octet-stream'}\r\n\r\n`));
300
304
  controller.enqueue(Buffer.from(await value.arrayBuffer()));
301
305
  }
302
- else {
303
- controller.enqueue(Buffer.from(`Content-Disposition: form-data; name="${key}"\r\n\r\n`));
304
- controller.enqueue(Buffer.from(value));
305
- }
306
306
  if (entries.length === 0) {
307
307
  controller.enqueue(Buffer.from(`\r\n--${boundary}--\r\n`));
308
308
  controller.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.0.2-alpha-20230202184428-e0c4cca",
3
+ "version": "0.0.2-alpha-20230202184911-724f9bd",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {