@whatwg-node/node-fetch 0.4.18 → 0.4.19-rc-20230914185319-cb780a6
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/Blob.js +2 -4
- package/cjs/Body.js +14 -16
- package/esm/Blob.js +2 -4
- package/esm/Body.js +14 -16
- package/package.json +1 -1
package/cjs/Blob.js
CHANGED
@@ -126,10 +126,8 @@ class PonyfillBlob {
|
|
126
126
|
controller.enqueue(buf);
|
127
127
|
});
|
128
128
|
}
|
129
|
-
|
130
|
-
|
131
|
-
controller.enqueue(buf);
|
132
|
-
}
|
129
|
+
const buf = getBlobPartAsBuffer(blobPart);
|
130
|
+
controller.enqueue(buf);
|
133
131
|
}
|
134
132
|
},
|
135
133
|
});
|
package/cjs/Body.js
CHANGED
@@ -69,23 +69,21 @@ class PonyfillBody {
|
|
69
69
|
return null;
|
70
70
|
}
|
71
71
|
_collectChunksFromReadable() {
|
72
|
+
const _body = this.generateBody();
|
73
|
+
if (!_body) {
|
74
|
+
return (0, utils_js_1.fakePromise)([]);
|
75
|
+
}
|
76
|
+
const chunks = [];
|
77
|
+
_body.readable.on('data', chunk => {
|
78
|
+
chunks.push(chunk);
|
79
|
+
});
|
72
80
|
return new Promise((resolve, reject) => {
|
73
|
-
|
74
|
-
const _body = this.generateBody();
|
75
|
-
if (_body) {
|
76
|
-
_body.readable.on('data', chunk => {
|
77
|
-
chunks.push(chunk);
|
78
|
-
});
|
79
|
-
_body.readable.on('end', () => {
|
80
|
-
resolve(chunks);
|
81
|
-
});
|
82
|
-
_body.readable.on('error', e => {
|
83
|
-
reject(e);
|
84
|
-
});
|
85
|
-
}
|
86
|
-
else {
|
81
|
+
_body.readable.once('end', () => {
|
87
82
|
resolve(chunks);
|
88
|
-
}
|
83
|
+
});
|
84
|
+
_body.readable.once('error', e => {
|
85
|
+
reject(e);
|
86
|
+
});
|
89
87
|
});
|
90
88
|
}
|
91
89
|
blob() {
|
@@ -113,7 +111,7 @@ class PonyfillBody {
|
|
113
111
|
const formData = new FormData_js_1.PonyfillFormData();
|
114
112
|
const _body = this.generateBody();
|
115
113
|
if (_body == null) {
|
116
|
-
return
|
114
|
+
return (0, utils_js_1.fakePromise)(formData);
|
117
115
|
}
|
118
116
|
const formDataLimits = {
|
119
117
|
...this.options.formDataLimits,
|
package/esm/Blob.js
CHANGED
@@ -123,10 +123,8 @@ export class PonyfillBlob {
|
|
123
123
|
controller.enqueue(buf);
|
124
124
|
});
|
125
125
|
}
|
126
|
-
|
127
|
-
|
128
|
-
controller.enqueue(buf);
|
129
|
-
}
|
126
|
+
const buf = getBlobPartAsBuffer(blobPart);
|
127
|
+
controller.enqueue(buf);
|
130
128
|
}
|
131
129
|
},
|
132
130
|
});
|
package/esm/Body.js
CHANGED
@@ -65,23 +65,21 @@ export class PonyfillBody {
|
|
65
65
|
return null;
|
66
66
|
}
|
67
67
|
_collectChunksFromReadable() {
|
68
|
+
const _body = this.generateBody();
|
69
|
+
if (!_body) {
|
70
|
+
return fakePromise([]);
|
71
|
+
}
|
72
|
+
const chunks = [];
|
73
|
+
_body.readable.on('data', chunk => {
|
74
|
+
chunks.push(chunk);
|
75
|
+
});
|
68
76
|
return new Promise((resolve, reject) => {
|
69
|
-
|
70
|
-
const _body = this.generateBody();
|
71
|
-
if (_body) {
|
72
|
-
_body.readable.on('data', chunk => {
|
73
|
-
chunks.push(chunk);
|
74
|
-
});
|
75
|
-
_body.readable.on('end', () => {
|
76
|
-
resolve(chunks);
|
77
|
-
});
|
78
|
-
_body.readable.on('error', e => {
|
79
|
-
reject(e);
|
80
|
-
});
|
81
|
-
}
|
82
|
-
else {
|
77
|
+
_body.readable.once('end', () => {
|
83
78
|
resolve(chunks);
|
84
|
-
}
|
79
|
+
});
|
80
|
+
_body.readable.once('error', e => {
|
81
|
+
reject(e);
|
82
|
+
});
|
85
83
|
});
|
86
84
|
}
|
87
85
|
blob() {
|
@@ -109,7 +107,7 @@ export class PonyfillBody {
|
|
109
107
|
const formData = new PonyfillFormData();
|
110
108
|
const _body = this.generateBody();
|
111
109
|
if (_body == null) {
|
112
|
-
return
|
110
|
+
return fakePromise(formData);
|
113
111
|
}
|
114
112
|
const formDataLimits = {
|
115
113
|
...this.options.formDataLimits,
|