fix: better HEAD handling with less special casing (#1206)

We now add a default HEAD handler to the server, rather than special
casing HEAD requests elsewhere. Static files now get their own optimized
HEAD handler that does not read the file contents.
This commit is contained in:
Luca Casonato
2023-05-30 17:22:18 +10:00
committed by GitHub
parent 87b087e358
commit 96ba036c12
2 changed files with 62 additions and 17 deletions
+2 -2
View File
@@ -67,7 +67,7 @@ Deno.test("/[name] page prerender", async () => {
assertStringIncludes(body, "<div>Hello bar</div>");
});
Deno.test("/intercept - HEAD", async () => {
Deno.test("/api/head_override - HEAD", async () => {
const req = new Request("https://fresh.deno.dev/api/head_override", {
method: "HEAD",
});
@@ -81,7 +81,7 @@ Deno.test("/intercept - HEAD", async () => {
);
});
Deno.test("/intercept - HEAD fallback", async () => {
Deno.test("/api/get_only - HEAD fallback", async () => {
const req = new Request("https://fresh.deno.dev/api/get_only", {
method: "HEAD",
});