@whatwg-node/node-fetch 0.0.2-alpha-20230202184428-e0c4cca → 0.0.2-alpha-20230202185216-2aa5539
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/index.js +5 -5
- package/index.mjs +5 -5
- 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
|
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
|
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