x/oak/response.ts

A middleware framework for handling HTTP with Deno, Node, Bun and Cloudflare Workers 🐿️ 🦕
Very Popular
Latest
method Response.prototype.with
import { Response } from "https://dotland-vbqsvsrpfncg.deno-staging.dev/x/oak@v17.1.2/response.ts?p=prototype.with&s=Response";

Instead of responding based on the values of the response, explicitly set the response with a Fetch API Response.

If the response is already finalized, this will throw. You can check the .writable property to determine the state if you are unsure.

[!NOTE] This will ignore/override values set in the response like the body, headers and status, meaning things like cookie management and automatic body typing will be ignored.

Parameters

response: globalThis.Response[src]

Instead of responding based on the values of the response, explicitly set the response by providing the initialization to create a Fetch API Response.

If the response is already finalized, this will throw. You can check the .writable property to determine the state if you are unsure.

[!NOTE] This will ignore/override values set in the response like the body, headers and status, meaning things like cookie management and automatic body typing will be ignored.

Parameters

optional
body: BodyInit | null
[src]
optional
init: ResponseInit
[src]