arizona_cowboy_req (arizona_cowboy v0.1.0)

View Source

Cowboy adapter for the arizona_req behaviour.

The raw value is Cowboy's request map. Path bindings are the ones arizona_route_table matched, stored on the request under Cowboy's own bindings key (binary names, percent-decoded values), since Cowboy's router only saw the adapter's catch-all route.

Summary

Functions

Wraps a Cowboy request in an arizona_req:request().

Resolves a navigate target against the routes of the listener that accepted CowboyReq, matched as a GET (an HTTP/2 WebSocket upgrade is a CONNECT). error for anything but a live route; never crashes, never replies.

Functions

new(CowboyReq)

-spec new(CowboyReq) -> arizona_req:request() when CowboyReq :: cowboy_req:req().

Wraps a Cowboy request in an arizona_req:request().

parse_bindings(CowboyReq)

-spec parse_bindings(cowboy_req:req()) -> arizona_req:bindings().

parse_cookies(CowboyReq)

-spec parse_cookies(cowboy_req:req()) -> arizona_req:cookies().

parse_headers(CowboyReq)

-spec parse_headers(cowboy_req:req()) -> arizona_req:headers().

parse_params(CowboyReq)

-spec parse_params(cowboy_req:req()) -> arizona_req:params().

peer(CowboyReq)

read_body(CowboyReq)

-spec read_body(CowboyReq) -> {ok, arizona_req:body(), CowboyReq} | {error, arizona_req:body_error()}
                   when CowboyReq :: cowboy_req:req().

resolve_route(Path, Qs, CowboyReq)

-spec resolve_route(Path, Qs, CowboyReq) -> {ok, Handler, RouteOpts, ArzReq} | error
                       when
                           Path :: arizona_req:path(),
                           Qs :: arizona_req:qs(),
                           CowboyReq :: cowboy_req:req(),
                           Handler :: module(),
                           RouteOpts :: arizona_live:route_opts(),
                           ArzReq :: arizona_req:request().

Resolves a navigate target against the routes of the listener that accepted CowboyReq, matched as a GET (an HTTP/2 WebSocket upgrade is a CONNECT). error for anything but a live route; never crashes, never replies.

scheme(CowboyReq)

-spec scheme(cowboy_req:req()) -> arizona_req:scheme().