Whether an error response is one its route declares — the one rule the DEV
error check (http/dev_route_error_check.ts) and the test helpers
(assert_response_matches_spec) share.
A JSON body at an error status (400 and up) is declared when the route's
error map (resolve_route_error_map) has that status and the body parses
against it. Three exemptions: a 500 internal_error and a 503
service_unavailable (ALWAYS_ACCEPTED_ERRORS), which the catch layers
answer on any route and no route declares, and, on a jsonrpc route, a
JSON-RPC error envelope, which no REST error definition describes. A
non-JSON response, by is_json_response, is not checked at all.
Also the hono-free route lookup the test helpers run (find_route_spec):
a route's Hono path template read segment by segment (split_route_template,
parse_route_param) and compiled to a RegExp (compile_route_path),
and the first route in mount order matching a request, HEAD read as
GET (find_mounted_route). The DEV check, on the Hono side, looks routes
up with Hono's own router (create_route_lookup); the two are pinned
against Hono and each other by the route-lookup tests.
Hono-free and esm-env-free.