schangxiang@126.com
2025-09-19 0821aa23eabe557c0d9ef5dbe6989c68be35d1fe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Type definitions for body-parser 1.17
// Project: https://github.com/expressjs/body-parser
// Definitions by: Santi Albo <https://github.com/santialbo>
//                 Vilic Vane <https://github.com/vilic>
//                 Jonathan Häberle <https://github.com/dreampulse>
//                 Gevik Babakhani <https://github.com/blendsdk>
//                 Tomasz Łaziuk <https://github.com/tlaziuk>
//                 Jason Walton <https://github.com/jwalton>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
 
/// <reference types="node" />
 
import { NextHandleFunction } from 'connect';
import * as http from 'http';
 
// for docs go to https://github.com/expressjs/body-parser/tree/1.16.0#body-parser
 
// @deprecated
declare function bodyParser(options?: bodyParser.OptionsJson & bodyParser.OptionsText & bodyParser.OptionsUrlencoded): NextHandleFunction;
 
declare namespace bodyParser {
    interface Options {
        inflate?: boolean;
        limit?: number | string;
        type?: string | string[] | ((req: http.IncomingMessage) => any);
        verify?(req: http.IncomingMessage, res: http.ServerResponse, buf: Buffer, encoding: string): void;
    }
 
    interface OptionsJson extends Options {
        reviver?(key: string, value: any): any;
        strict?: boolean;
    }
 
    interface OptionsText extends Options {
        defaultCharset?: string;
    }
 
    interface OptionsUrlencoded extends Options {
        extended?: boolean;
        parameterLimit?: number;
    }
 
    function json(options?: OptionsJson): NextHandleFunction;
 
    function raw(options?: Options): NextHandleFunction;
 
    function text(options?: OptionsText): NextHandleFunction;
 
    function urlencoded(options?: OptionsUrlencoded): NextHandleFunction;
}
 
export = bodyParser;