all repos — homestead @ 90029fa86a8daeec421464720b2b7b216db52f59

Code for my website

send textual 404 if not accepting text/html

Alan Pearce
commit

90029fa86a8daeec421464720b2b7b216db52f59

parent

7098e92b180061e10673aa1a3e22472482248f33

1 file changed, 5 insertions(+), 0 deletions(-)

jump to
M src/app.tssrc/app.ts
@@ -235,6 +235,11 @@ });
} status = 404; const notfound = files.get("/404.html"); + if (!request.headers.get("accept")?.split(",").includes("text/html")) { + return new Response("404 Not Found", { + status, + }); + } if (notfound) { return serveFile(notfound, status, { "content-type": "text/html; charset=utf-8",