e01e9ed0
chimw: the request line in the journal, HEAD routes, and a 405 page
Three things at once, all of them the chi half of the shared middleware. RequestLogger replaces chi's Logger, which wrote an unstructured line to stdout — the highest-volume record this daemon emits and the only one not beside the rest on stderr. RequestID goes above it so the request line and a panic report share an id, Recoverer below it so its own report goes through the entry instead of to stdout, and /healthz is skipped. GetHead registers every read route under HEAD as well. Until now `curl -I` and every uptime probe were answered 405 plus a kilobyte of rendered error page by pages whose whole job is to be cheap to ask about. RenderRefusals installs both routing failures against renderError; this service had the 404 alone and left the 405 to net/http's plain text. The new test that pins it also corrects what TestUnsafeMethodRefused claimed: the group's middleware runs before either refusal, so an unsafe method on a GET-only path is a 403 from the same-origin guard, not a 405.
bigbes <bigbes@gmail.com> — 2026-08-08 21:25:48 UTC
Commit e01e9ed02ec22b7bdebac9ae8327784c4fac2245 —
view raw patch
Parent(s):
aca0674e
| File | Status | + | − |
|---|---|---|---|
README.md
|
M | +4 | -2 |
cmd/comparesrht/main.go
|
M | +20 | -7 |
web/router.go
|
M | +17 | -9 |
web/server.go
|
M | +2 | -1 |
web/web_test.go
|
M | +60 | -6 |