Skip to main content

ROUTE_RESPONSE_WALK

Constant ROUTE_RESPONSE_WALK 

Source
pub const ROUTE_RESPONSE_WALK: &str = "__lgx_route_response_for";
Expand description

★ THE SERVING WALK — the ONE __lgx_route_handler runs, answering a whole Response.

The other four answer one question each and are what route(…), routeStatus(…), routeContentType(…) and routeHeader(…) are built on. The handler must not compose them: routeStatusWith and routeContentTypeWith answer per-route CONSTANTS and never call a route’s function, which is exactly what made “the handler runs once per request” true — and a Response route breaks it, because its status and content type are FIELDS OF THE ANSWER. Reading them through those walks would call the route once per walk, so a login would execute four times for one request: harmless for setting a cookie, a bug for writing a session row.

So this walk exists, built in the SAME loop from the SAME conditions as the other four, and it calls each matched route exactly once. ## Before each request runs once in it too, which the old body-and-status pair never managed either.