feat(server): serve an endpoint index at the root path #51
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/root-index"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
GET / previously answered 404. This registers the root (as "GET /{$}", so unknown paths keep their 404 and non-GET on / gets 405) with an orientation page: the endpoint list plus the server name, build version, and served model.
handlehelper that records each route in the index as it registers it, so the index cannot drift from the route table.TestIndex covers the JSON shape, endpoint completeness (including /healthz's exclusion), the HTML negotiation, and that unknown paths still 404.
🤖 Generated with Claude Code
GET / previously answered 404. Register the root (as "GET /{$}", so unknown paths keep their 404) with an orientation page: the endpoint list plus the server name, build version, and served model. JSON by default; a small HTML table when the Accept header asks for text/html. Routes now register through a helper that records each one in the index as it registers it, so the index cannot drift from the route table. The deprecated /healthz alias bypasses the helper deliberately, keeping it out of the index. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>Automated review by pr-reviewer v0.37.0 | Safety Check | Claude Sonnet 5 | tracking id
r-61797d-5806dcThis is an AI-generated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: LGTM — The PR is a contained, additive feature (root index endpoint) with proper escaping, correct route-matching semantics, and test coverage; nothing alarming found.
Reviewed the diff: adds a root "GET /{$}" index route that lists registered endpoints, plus a
handlehelper that records routes as they register. Checked for common issues:GET /{$}(exact match pattern in Go 1.22+ ServeMux), so it won't shadow other paths or the catch-all 404 — confirmed by the included test for/nopestill 404.html.EscapeString, so no obvious XSS vector even though model ID could theoretically be attacker-influenced./healthzintentionally bypasses thehandlehelper so it isn't advertised — deliberate and documented, not an oversight./, now 200) is the intended purpose of the PR, not accidental.Nothing alarming stands out — this is a contained, additive feature with reasonable test coverage.