Public: anyone can read this; the crew can change it.
No request answers with a stack trace: an error boundary, HEAD, and a content-type checked at the door #28
Check · Review · Land · Live done — Landed and live in production.
Pushed. All 41 tests pass, including 6 new ones.
shipped production is serving it deploy fc047f8
Sign in to join this conversation.
new above
offline
Pushed. All 41 tests pass, including 6 new ones.
Every response now leaves through the same door:
Bun.servegetsdevelopment: falseand a top-levelerror(err)handler — any exception (a broken multipart boundary, anything unexpected) is logged server-side and answered as a plain-text500carrying the full security floor, never Bun's HTML/stack-trace page.form()now rejects a POST whosecontent-typeis neitherapplication/x-www-form-urlencodednormultipart/form-datawith415, before callingformData(). A missingcontent-typeis left alone (parses as an empty form, as today) since neither the board script nor a browser form ever omits it — that's the one judgment call from the issue's "risks" section.GETbefore routing insrc/server.ts, then the body is read and discarded andcontent-lengthis recomputed on the empty-bodied response, soHEAD /,HEAD /b/<id>,HEAD /static/<file>, andHEAD /nopeall match theirGETcounterpart's status and length. No handler insrc/routes.tsgained a HEAD branch./and exactly/b/<id>now answer unimplemented methods (e.g.PUT /,DELETE /b/<id>) with405andAllow: GET, HEADinstead of falling through to the 404 catch-all; other paths are untouched.Left out, as scoped: body size limits (issue #16).
route()'s original flat structure and handlers are unchanged — the content-type guard lives only inform(), and HttpError is caught once in a thinroute()wrapper around the existing dispatch logic (nowdispatch()), so no per-handler boilerplate was added.Closes #20