@whatwg-node/node-fetch 0.4.9 → 0.4.10-alpha-20230719102745-2c637ff

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/fetchCurl.js CHANGED
@@ -23,14 +23,19 @@ function fetchCurl(fetchRequest) {
23
23
  : 1
24
24
  : 0;
25
25
  });
26
- const nodeReadable = (fetchRequest.body != null
27
- ? 'pipe' in fetchRequest.body
28
- ? fetchRequest.body
29
- : node_stream_1.Readable.from(fetchRequest.body)
30
- : null);
31
- if (nodeReadable) {
32
- curlHandle.setOpt('UPLOAD', true);
33
- curlHandle.setUploadStream(nodeReadable);
26
+ if (fetchRequest['bodyType'] === 'String') {
27
+ curlHandle.setOpt('POSTFIELDS', fetchRequest['bodyInit']);
28
+ }
29
+ else {
30
+ const nodeReadable = (fetchRequest.body != null
31
+ ? 'pipe' in fetchRequest.body
32
+ ? fetchRequest.body
33
+ : node_stream_1.Readable.from(fetchRequest.body)
34
+ : null);
35
+ if (nodeReadable) {
36
+ curlHandle.setOpt('UPLOAD', true);
37
+ curlHandle.setUploadStream(nodeReadable);
38
+ }
34
39
  }
35
40
  if (process.env.DEBUG) {
36
41
  curlHandle.setOpt('VERBOSE', true);
package/esm/fetchCurl.js CHANGED
@@ -20,14 +20,19 @@ export function fetchCurl(fetchRequest) {
20
20
  : 1
21
21
  : 0;
22
22
  });
23
- const nodeReadable = (fetchRequest.body != null
24
- ? 'pipe' in fetchRequest.body
25
- ? fetchRequest.body
26
- : Readable.from(fetchRequest.body)
27
- : null);
28
- if (nodeReadable) {
29
- curlHandle.setOpt('UPLOAD', true);
30
- curlHandle.setUploadStream(nodeReadable);
23
+ if (fetchRequest['bodyType'] === 'String') {
24
+ curlHandle.setOpt('POSTFIELDS', fetchRequest['bodyInit']);
25
+ }
26
+ else {
27
+ const nodeReadable = (fetchRequest.body != null
28
+ ? 'pipe' in fetchRequest.body
29
+ ? fetchRequest.body
30
+ : Readable.from(fetchRequest.body)
31
+ : null);
32
+ if (nodeReadable) {
33
+ curlHandle.setOpt('UPLOAD', true);
34
+ curlHandle.setUploadStream(nodeReadable);
35
+ }
31
36
  }
32
37
  if (process.env.DEBUG) {
33
38
  curlHandle.setOpt('VERBOSE', true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.4.9",
3
+ "version": "0.4.10-alpha-20230719102745-2c637ff",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {