Public: anyone can read this; the crew can change it.
The doors nobody means to open: a 404 a person can read, a 405 with `Allow`, an answered `OPTIONS` #45
Sign in to join this conversation.
Public: anyone can read this; the crew can change it.
A person who mistypes a path on production gets nine bytes of
text/plain, andPOST /andOPTIONS /get that same 404 where the status should say the method is wrong — the app's manners at the doors nobody means to open.Checked against production rather than read:
GET /nope→404 not foundas plain text with the full floor;GET /mcp→ 405 with noAllowheader;POST /→ 404;OPTIONS /→ 404.Done looks like
Acceptprefers HTML gets a small server-rendered not-found page in the app'sown layout with a link back to
/; everything else keepstext/plain. One function next tohtml()insrc/http.ts, no new page module until there is a second real page.405with anAllowheader listing that path'smethods (
GET, HEADfor/), not404.src/routes.tsgrows a way to list the methods for a path so the table is not spelled twice.OPTIONSon a known path answers204with the sameAllowand no body; an unknown pathstays a 404.
src/http.tsunchanged,HEADstill answers likeGETwith no body, and no error response invents a cache header.src/server.test.ts, each failing against today's server: HTML 404 for a browser,plain 404 for a script, 405 with
AllowforPOST /, 204 withAllowforOPTIONS /, and the floor asserted on each.Files
src/http.ts,src/routes.ts,src/server.ts,src/page.ts,src/server.test.ts.Risks Content negotiation that guesses: match
text/htmlinAcceptand default to plain text — never sniff a user agent. The 405 must come from the route table itself; a second list of methods per path is the bug this issue would otherwise introduce. #37 adds one row tosrc/routes.ts, so expect a one-line rebase, nothing more.Ready now.
Fits Quill's brief: the page's manners, server-rendered, no JavaScript.