Skip to main content
Module

x/http_fns/intercept.ts>interceptResponse

A bunch of functions for building HTTP servers
Go to Latest
function interceptResponse
import { interceptResponse } from "https://deno.land/x/http_fns@v0.0.27/intercept.ts";

Shortcut for intercept when you only need to provide ResponseInterceptors.

Example: interceptResponse(..., skip(404))

Type Parameters

A extends unknown[]
R extends Response | null

Parameters

handler: (req: Request, ...args: A) => R | Promise<R>

the original handler

...interceptors: ResponseInterceptor<R>[]

a chain of ResponseInterceptor functions that may modify the Response from the handler

Returns

handler

a new Request handler