mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 06:29:40 +08:00
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
// Type definitions for express-mung 0.4.2
|
|
// Project: https://github.com/richardschneider/express-mung
|
|
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.3
|
|
|
|
/// <reference types="express"/>
|
|
/// <reference types="node"/>
|
|
|
|
declare module "express-mung" {
|
|
import { Request, Response } from "express";
|
|
import * as http from "http";
|
|
|
|
type Transform = (body: {}, request: Request, response: Response) => any;
|
|
type TransformHeader = (body: http.IncomingMessage, request: Request, response: Response) => any;
|
|
|
|
/**
|
|
* Transform the JSON body of the response.
|
|
* @param {Transform} fn A transformation function.
|
|
* @return {any} The body.
|
|
*/
|
|
export function json(fn: Transform): any;
|
|
|
|
/**
|
|
* Transform the JSON body of the response.
|
|
* @param {Transform} fn A transformation function.
|
|
* @return {any} The body.
|
|
*/
|
|
export function jsonAsync(fn: Transform): PromiseLike<any>;
|
|
|
|
/**
|
|
* Transform the HTTP headers of the response.
|
|
* @param {Transform} fn A transformation function.
|
|
* @return {any} The body.
|
|
*/
|
|
export function headers(fn: TransformHeader): any;
|
|
|
|
/**
|
|
* Transform the HTTP headers of the response.
|
|
* @param {Transform} fn A transformation function.
|
|
* @return {any} The body.
|
|
*/
|
|
export function headersAsync(fn: TransformHeader): PromiseLike<any>;
|
|
}
|