Author SHA1 Message Date
sneak 10ba759ee6 Give every JSON answer @meta, errors included (closes #201)
check / check (push) Canceled after 0s
A panic in a JSON route's handler answered 500 with an empty body,
because the router's recoverer sits outside the middleware that adds
`@meta`. `JSONValidationMiddleware` now wraps the handler in the same
recoverer, and answers the panic with the JSON error body.

A method that `/status.json` or the health check does not take got
chi's empty 405. Each such method now goes to the JSON 405 that the
routes under `/api/v1` and `/ip` give.

The home page's IP lookup card showed only the answer's `data`. It now
shows the whole answer, `@meta` included.

A table test checks `@meta` on every JSON route, in its successes and
its errors.

Model: opus-5-5
2026-10-27 20:03:14 +00:00
2 changed files with 563 additions and 610 deletions
+557 -600
View File
File diff suppressed because it is too large Load Diff
+6 -10
View File
@@ -35,17 +35,13 @@ tested.
# Completed Steps # Completed Steps
- 2026-10-27: README "Rationale" says why RouteWatch exists: to answer our other
services' questions about IP addresses, from its own routing table and the
WHOIS details it keeps. It still says what RIS Live does not give (closes
#204)
- 2026-10-27: every JSON answer carries `@meta`. A panic on a JSON route answers - 2026-10-27: every JSON answer carries `@meta`. A panic on a JSON route answers
500 with the JSON error body. `/status.json` and the health check answer 405 500 with the JSON error body. A method that `/status.json` or the health check
with the JSON error body to any method they do not take. The 500 and the 405 does not take answers 405 with it, as under `/api/v1`. Both used to answer
used to have an empty body. The home page's IP lookup shows the whole JSON with an empty body. The home page's IP lookup shows the whole JSON answer,
answer, `@meta` included. It used to show only the answer's `data`, or only `@meta` included. It used to show only the answer's `data`, or only the
the message of an error answer. A test checks `@meta` on every JSON route, in message of an error answer. A test checks `@meta` on every JSON route, in its
its successes and its errors (closes #201) successes and its errors (closes #201)
- 2026-10-27: every value in a JSON answer that has a unit is a number, with the - 2026-10-27: every value in a JSON answer that has a unit is a number, with the
unit at the end of its field name. `@meta.execution_time` is now unit at the end of its field name. `@meta.execution_time` is now
`execution_time_ms`. The stats' `uptime`, `connection_duration` and `execution_time_ms`. The stats' `uptime`, `connection_duration` and