mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
merged conflict
This commit is contained in:
parent
2e08343a0d
commit
2d77b19dfa
180
body-parser/body-parser.d.ts
vendored
180
body-parser/body-parser.d.ts
vendored
@ -1,64 +1,138 @@
|
||||
// Type definitions for body-parser
|
||||
// Project: http://expressjs.com
|
||||
// Definitions by: Jonathan Häberle <https://github.com/dreampulse/>
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>, VILIC VANE <https://vilic.info>, Jonathan Häberle <https://github.com/dreampulse/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "body-parser" {
|
||||
import express = require('express');
|
||||
import express = require('express');
|
||||
|
||||
module e {
|
||||
/**
|
||||
* bodyParser: use individual json/urlencoded middlewares
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
// JSON Options
|
||||
interface JsonOptions {
|
||||
strict? : boolean; // only parse objects and arrays. (default: true)
|
||||
inflate? : boolean; // if deflated bodies will be inflated. (default: true)
|
||||
limit? : number; // maximum request body size. (default: <100kb>)
|
||||
reviver? : (k :any, v:any) => any // passed to JSON.parse()
|
||||
type? : string; // request content-type to parse (default: json)
|
||||
verify? : (req : express.Request, res : express.Response, streamBuf : any, encoding : string) => void; // function to verify body content
|
||||
function bodyParser(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* only parse objects and arrays. (default: true)
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
receiver?: (key: string, value: any) => any;
|
||||
/**
|
||||
* parse extended syntax with the qs module. (default: true)
|
||||
*/
|
||||
extended?: boolean;
|
||||
}): express.RequestHandler;
|
||||
|
||||
module bodyParser {
|
||||
export function json(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'json')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* only parse objects and arrays. (default: true)
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
receiver?: (key: string, value: any) => any;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function raw(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'application/octet-stream')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function text(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'text/plain')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* the default charset to parse as, if not specified in content-type. (default: 'utf-8')
|
||||
*/
|
||||
defaultCharset?: string;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function urlencoded(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'urlencoded')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* parse extended syntax with the qs module. (default: true)
|
||||
*/
|
||||
extended?: boolean;
|
||||
}): express.RequestHandler;
|
||||
}
|
||||
|
||||
// Raw Options
|
||||
interface RawOptions {
|
||||
inflate? : boolean; // if deflated bodies will be inflated. (default: true)
|
||||
limit? :number; // maximum request body size. (default: <100kb>)
|
||||
type? : string; // request content-type to parse (default: application/octet-stream)
|
||||
verify? : (req : express.Request, res : express.Response, streamBuf : any, encoding : string) => void; // function to verify body content
|
||||
}
|
||||
|
||||
// Text Options
|
||||
interface TextOptions {
|
||||
defaultCharset? : string; // the default charset to parse as, if not specified in content-type. (default: utf-8)
|
||||
inflate? : boolean; // if deflated bodies will be inflated. (default: true)
|
||||
limit? : number; // maximum request body size. (default: <100kb>)
|
||||
type? : string; // request content-type to parse (default: text/plain)
|
||||
verify? : (req : express.Request, res : express.Response, streamBuf : any, encoding : string) => void; // function to verify body content
|
||||
}
|
||||
|
||||
// UrlEncoded Options
|
||||
interface UrlEncodedOptions {
|
||||
extended? : boolean; // parse extended syntax with the qs module. (default: true)
|
||||
inflate? : boolean; // if deflated bodies will be inflated. (default: true)
|
||||
limit: number; // maximum request body size. (default: <100kb>)
|
||||
type: string; // request content-type to parse (default: urlencoded)
|
||||
verify? : (req : express.Request, res : express.Response, streamBuf : any, encoding : string) => void; // function to verify body content
|
||||
}
|
||||
|
||||
|
||||
// Returns middleware that only parses json
|
||||
function json(options? : JsonOptions) : express.RequestHandler;
|
||||
|
||||
// Returns middleware that parses all bodies as a Buffer
|
||||
function raw(options? : RawOptions) : express.RequestHandler;
|
||||
|
||||
// Returns middleware that parses all bodies as a string
|
||||
function text(options? : TextOptions) : express.RequestHandler;
|
||||
|
||||
// Returns middleware that only parses urlencoded bodies
|
||||
function urlencoded(options? : UrlEncodedOptions) : express.RequestHandler;
|
||||
}
|
||||
|
||||
export = e;
|
||||
}
|
||||
export = bodyParser;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user