Skip to content

ForwardRequestInit

ForwardRequestInit = object

Defined in: packages/actions/src/forward-request.ts:11

Options accepted by forwardRequest.

Pass body to replace the original body (typical when an action handler builds a sub-action’s payload), method to override the HTTP method, or url to dispatch to a different route. Any field omitted defaults to the value from the source request, so the new request stays a faithful clone of the original — including cookies, Authorization, X-CSRF-Token, and any other headers your auth or middleware layer relies on.

optional body: BodyInit | null

Defined in: packages/actions/src/forward-request.ts:22

Replacement body for the forwarded request. Accepts anything Request itself accepts (including FormData, URLSearchParams, string, and ReadableStream). Pass null to forward without a body.

Defaults to the source request’s body. Note that streaming bodies are single-use, so the source request will be drained when forwarding the default body — clone the source request first if you need to read it elsewhere.


optional headers: HeadersInit

Defined in: packages/actions/src/forward-request.ts:32

Additional headers to merge on top of the forwarded headers. Use this to set Content-Type (e.g. when replacing the body with JSON) without having to assemble a full Headers instance manually.


optional method: string

Defined in: packages/actions/src/forward-request.ts:24

HTTP method override. Defaults to the source request’s method.


optional url: string

Defined in: packages/actions/src/forward-request.ts:26

URL override. Defaults to the source request’s URL.