Module

x/oak/mod.ts>Response#with

A middleware framework for handling HTTP with Deno 🐿️ 🦕
Extremely Popular
Go to Latest
method Response.prototype.with
import { Response } from "https://dotland.deno.dev/x/oak@v13.2.3/mod.ts";

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

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
optional
init: ResponseInit