std1.0.0-beta-7 SafeC docs

std :: http::router

Struct std::HttpCtx

#include <std/http/router.h> source

struct HttpCtx {
    &HttpConn conn;
    struct Vec<struct RouteParam> params;
    int route_index;
    long long start_ns;
}

Per-request context passed to route handlers and middleware.

Fields

the connection (peer, keep-alive, detach)

§struct Vec<struct RouteParam> paramssource
§int route_indexsource

index of the matched route, -1 if none

§long long start_nssource

when dispatch began (monotonic clock)

Methods

§const ?&char param(const &char name) constsource · definition

A captured path parameter (":name" / "name"; "" for a bare wildcard), percent-decoded, or null.

§const &char param_or(const &char name, const &char fallback) constsource · definition
§const &char pattern() constsource · definition

The pattern of the matched route ("" if none).