forked from Kong/httpsnippet
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: moving the node
fetch
client from node-fetch
to native
- Loading branch information
Showing
24 changed files
with
43 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
{ | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": "explicit" | ||
}, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
|
||
// controlled by the .editorconfig at root since we can't map vscode settings directly to files | ||
// https://github.com/microsoft/vscode/issues/35350 | ||
"files.insertFinalNewline": false | ||
"files.insertFinalNewline": false, | ||
|
||
"search.exclude": { | ||
"coverage": true, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
...tch/fixtures/application-form-encoded.cjs → ...etch/fixtures/application-form-encoded.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
.../node/fetch/fixtures/application-json.cjs → ...s/node/fetch/fixtures/application-json.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/targets/node/fetch/fixtures/cookies.cjs → src/targets/node/fetch/fixtures/cookies.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...ets/node/fetch/fixtures/custom-method.cjs → ...gets/node/fetch/fixtures/custom-method.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
src/targets/node/fetch/fixtures/full.cjs → src/targets/node/fetch/fixtures/full.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/targets/node/fetch/fixtures/headers.cjs → src/targets/node/fetch/fixtures/headers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...ets/node/fetch/fixtures/http-insecure.cjs → ...gets/node/fetch/fixtures/http-insecure.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...node/fetch/fixtures/jsonObj-multiline.cjs → .../node/fetch/fixtures/jsonObj-multiline.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...ode/fetch/fixtures/jsonObj-null-value.cjs → ...node/fetch/fixtures/jsonObj-null-value.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 4 additions & 8 deletions
12
...ts/node/fetch/fixtures/multipart-data.cjs → ...ets/node/fetch/fixtures/multipart-data.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import fs from 'fs'; | ||
|
||
const formData = new FormData(); | ||
formData.append('foo', await fs.openAsBlob('src/fixtures/files/hello.txt')); | ||
|
||
const url = 'https://httpbin.org/anything'; | ||
const options = {method: 'POST', body: formData}; | ||
|
||
fetch(url, options) | ||
.then(res => res.json()) | ||
.then(json => console.log(json)) | ||
.catch(err => console.error('error:' + err)); |
2 changes: 0 additions & 2 deletions
2
...ixtures/multipart-form-data-no-params.cjs → ...fixtures/multipart-form-data-no-params.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 1 addition & 6 deletions
7
...de/fetch/fixtures/multipart-form-data.cjs → ...ode/fetch/fixtures/multipart-form-data.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/targets/node/fetch/fixtures/nested.cjs → src/targets/node/fetch/fixtures/nested.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...ode/fetch/fixtures/postdata-malformed.cjs → ...node/fetch/fixtures/postdata-malformed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...ets/node/fetch/fixtures/query-encoded.cjs → ...gets/node/fetch/fixtures/query-encoded.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/targets/node/fetch/fixtures/query.cjs → src/targets/node/fetch/fixtures/query.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/targets/node/fetch/fixtures/short.cjs → src/targets/node/fetch/fixtures/short.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...argets/node/fetch/fixtures/text-plain.cjs → ...targets/node/fetch/fixtures/text-plain.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters