Add support for fetch() headers (#727)

This commit is contained in:
qti3e 2018-09-12 23:46:42 +04:30 committed by Ryan Dahl
parent cb6c78c6d2
commit 41c70b154f
8 changed files with 137 additions and 21 deletions

View file

@ -18,3 +18,20 @@ test(async function fetchPerm() {
assertEqual(err.kind, deno.ErrorKind.PermissionDenied);
assertEqual(err.name, "PermissionDenied");
});
testPerm({ net: true }, async function fetchHeaders() {
const response = await fetch("http://localhost:4545/package.json");
const headers = response.headers;
assertEqual(headers.get("Content-Type"), "application/json");
assert(headers.get("Server").startsWith("SimpleHTTP"));
});
test(async function headersAppend() {
let err;
try {
const headers = new Headers([["foo", "bar", "baz"]]);
} catch (e) {
err = e;
}
assert(err instanceof TypeError);
});