1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

fix(fetch): OPTIONS should be allowed a non-null body (#11242)

This commit is contained in:
Craig Morten 2021-07-05 11:38:12 +01:00 committed by GitHub
parent 3ee0c36453
commit a6c840d150
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -1217,3 +1217,13 @@ unitTest(
await done;
},
);
unitTest(
{ perms: { net: true } },
async function fetchHeadRespBody() {
const res = await fetch("http://localhost:4545/echo_server", {
method: "HEAD",
});
assertEquals(res.body, null);
},
);

View file

@ -271,7 +271,7 @@
if (nullBodyStatus(response.status)) {
core.close(resp.responseRid);
} else {
if (req.method === "HEAD" || req.method === "OPTIONS") {
if (req.method === "HEAD" || req.method === "CONNECT") {
response.body = null;
core.close(resp.responseRid);
} else {