fetch: proper error for unsupported protocol (#4085)

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2020-02-23 06:45:02 -08:00 committed by GitHub
parent bf48f5fa5a
commit e9fff02e96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

View file

@ -9,6 +9,17 @@ import {
fail
} from "./test_util.ts";
testPerm({ net: true }, async function fetchProtocolError(): Promise<void> {
let err;
try {
await fetch("file:///");
} catch (err_) {
err = err_;
}
assert(err instanceof TypeError);
assertStrContains(err.message, "not supported");
});
testPerm({ net: true }, async function fetchConnectionError(): Promise<void> {
let err;
try {