Skip to main content
Module

x/cav/http.ts>RequestData

A server framework for Deno
Go to Latest
interface RequestData
import { type RequestData } from "https://deno.land/x/cav@0.0.8/http.ts";

A metadata object generated once for every request.

Properties

res: Headers

Response headers that should be applied to whatever Response ends up being sent back to the client.

url: URL

WHATWG URL object generated from the request.url.

path: string

The request path. This is intended to be modified by a Stack. When the RequestData is initially generated, this is equal to the url.pathname. As the request gets processed, the Stack matches this path against registered routes. When a route matches and has a forwarded-wildcard (ends in "/*"), this path will be the value of that wildcard inside the next handler (either an Rpc or Stack). When a route matches and doesn't have that wildcard, the Stack will modify this path to be "/" inside the next handler.

groups: Record<string, string>

As Stacks process a request, they can capture path groups. The path groups are stored in this object. Old groups will be overwritten by groups captured further down the handler tree.

query: Record<string, string | string[]>

An object created from the url.searchParams. This is what gets processed when an Rpc has a "query" parser.