diff options
author | 2022-01-26 14:37:44 -0800 | |
---|---|---|
committer | 2022-02-01 14:45:47 -0800 | |
commit | 9322cec8f261dda20a2a6cc6fe7aa887c4dfeeb9 (patch) | |
tree | f50b94ede39b40016300f25eda2deba7bffc88c5 /integration/bunjs-only-snippets/fetch.js | |
parent | 047501999dcd30eeb6da614ec62773b34ad03ae8 (diff) | |
download | bun-9322cec8f261dda20a2a6cc6fe7aa887c4dfeeb9.tar.gz bun-9322cec8f261dda20a2a6cc6fe7aa887c4dfeeb9.tar.zst bun-9322cec8f261dda20a2a6cc6fe7aa887c4dfeeb9.zip |
WIP
Diffstat (limited to 'integration/bunjs-only-snippets/fetch.js')
-rw-r--r-- | integration/bunjs-only-snippets/fetch.js | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/integration/bunjs-only-snippets/fetch.js b/integration/bunjs-only-snippets/fetch.js index cc83b5af4..bb4345659 100644 --- a/integration/bunjs-only-snippets/fetch.js +++ b/integration/bunjs-only-snippets/fetch.js @@ -1,14 +1,17 @@ import fs from "fs"; -const response = await fetch("http://example.com/"); -const text = await response.text(); +const urls = ["https://example.com", "http://example.com"]; +for (let url of urls) { + const response = await fetch(url); + const text = await response.text(); -if ( - fs.readFileSync( - import.meta.path.substring(0, import.meta.path.lastIndexOf("/")) + - "/fetch.js.txt", - "utf8" - ) !== text -) { - throw new Error("Expected fetch.js.txt to match snapshot"); + if ( + fs.readFileSync( + import.meta.path.substring(0, import.meta.path.lastIndexOf("/")) + + "/fetch.js.txt", + "utf8" + ) !== text + ) { + throw new Error("Expected fetch.js.txt to match snapshot"); + } } |