fetch support URL instance as input (#3496)

This commit is contained in:
Axetroy 2019-12-14 20:49:30 +08:00 committed by Ry Dahl
parent 7e116dd70d
commit 83f95fb8df
3 changed files with 21 additions and 13 deletions

View file

@ -42,6 +42,13 @@ testPerm({ net: true }, async function fetchUrl(): Promise<void> {
assertEquals(response.url, "http://localhost:4545/cli/tests/fixture.json");
});
testPerm({ net: true }, async function fetchURL(): Promise<void> {
const response = await fetch(
new URL("http://localhost:4545/cli/tests/fixture.json")
);
assertEquals(response.url, "http://localhost:4545/cli/tests/fixture.json");
});
testPerm({ net: true }, async function fetchHeaders(): Promise<void> {
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
const headers = response.headers;