ui-router-server / fetch / delegateContext
Function: delegateContext()
ts
function delegateContext<K, Decls>(
request,
key,
router?
): DelegateContext<K, Decls>;Defined in: fetch.ts:381
The route a request matched when the fetch adapter delegated it to key's handler: { mount, subpath, delegate, state, params }. Call it with the very Request the handler received (c.req.raw in a Hono route): the context is keyed by that object, so request.clone() or new Request(request) has none. Pass the router to type state and params from its as const routes and to check the request came through it.
Type Parameters
| Type Parameter | Default type |
|---|---|
K extends string | - |
Decls extends RouteDeclaration | RouteDeclaration |
Parameters
| Parameter | Type | Description |
|---|---|---|
request | Request | the request a delegate handler received |
key | K | the delegate key the handler is mapped to |
router? | ServerRouter<Decls> | the router the adapter was built with |
Returns
DelegateContext<K, Decls>
Throws
when the request was not delegated, was delegated to another key, or came through another router