@fly/cdn
Version:
Fly's TypeScript CDN
16 lines (15 loc) • 679 B
TypeScript
/**
* @module Middleware
*/
import { FetchGeneratorWithOptions } from "../fetch";
export declare type ResponseModifierResult = Promise<undefined | void | Response> | undefined | void | Response;
/**
* A convenience function for building middleware that only operates on a request.
* @param fn
*/
export declare function requestModifier<J>(fn: (req: Request, options: J) => ResponseModifierResult): FetchGeneratorWithOptions<J>;
/**
* A convenience function for building middleware that only operates on a response.
* @param fn
*/
export declare function responseModifier<J>(fn: (resp: Response, options: J) => Promise<Response> | Response): FetchGeneratorWithOptions<J>;