Skip to main content
Module

x/cav/mod.ts>response

A server framework for Deno
Go to Latest
function response
Re-export
import { response } from "https://deno.land/x/cav@0.0.20/mod.ts";

Creates an EndpointResponse from the provided body, which is serialized using the top-level serializeBody function. If the provided body is already a Response object, it will be returned with the headers provided on the init argument applied (if there are any). Extra serializers can be provided on the init argument to extend the data types that can be serialized.

Type Parameters

optional
T = unknown

Parameters

body: T
optional
init: EndpointResponseInit

Returns

EndpointResponse<T extends EndpointResponse<infer T2> ? T2 : T extends Response ? unknown : T>