You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@types/body-parser

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/body-parser - npm Package Compare versions

Comparing version
1.17.1
to
1.19.0
+58
-7
body-parser/index.d.ts

@@ -1,2 +0,2 @@

// Type definitions for body-parser 1.17
// Type definitions for body-parser 1.19
// Project: https://github.com/expressjs/body-parser

@@ -9,4 +9,4 @@ // Definitions by: Santi Albo <https://github.com/santialbo>

// Jason Walton <https://github.com/jwalton>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

@@ -18,12 +18,27 @@ /// <reference types="node" />

// for docs go to https://github.com/expressjs/body-parser/tree/1.16.0#body-parser
// for docs go to https://github.com/expressjs/body-parser/tree/1.19.0#body-parser
// @deprecated
declare function bodyParser(options?: bodyParser.OptionsJson & bodyParser.OptionsText & bodyParser.OptionsUrlencoded): NextHandleFunction;
/** @deprecated */
declare function bodyParser(
options?: bodyParser.OptionsJson & bodyParser.OptionsText & bodyParser.OptionsUrlencoded,
): NextHandleFunction;
declare namespace bodyParser {
interface Options {
/** When set to true, then deflated (compressed) bodies will be inflated; when false, deflated bodies are rejected. Defaults to true. */
inflate?: boolean;
/**
* Controls the maximum request body size. If this is a number,
* then the value specifies the number of bytes; if it is a string,
* the value is passed to the bytes library for parsing. Defaults to '100kb'.
*/
limit?: number | string;
/**
* The type option is used to determine what media type the middleware will parse
*/
type?: string | string[] | ((req: http.IncomingMessage) => any);
/**
* The verify option, if supplied, is called as verify(req, res, buf, encoding),
* where buf is a Buffer of the raw request body and encoding is the encoding of the request.
*/
verify?(req: http.IncomingMessage, res: http.ServerResponse, buf: Buffer, encoding: string): void;

@@ -33,3 +48,11 @@ }

interface OptionsJson extends Options {
/**
*
* The reviver option is passed directly to JSON.parse as the second argument.
*/
reviver?(key: string, value: any): any;
/**
* When set to `true`, will only accept arrays and objects;
* when `false` will accept anything JSON.parse accepts. Defaults to `true`.
*/
strict?: boolean;

@@ -39,2 +62,7 @@ }

interface OptionsText extends Options {
/**
* Specify the default character set for the text content if the charset
* is not specified in the Content-Type header of the request.
* Defaults to `utf-8`.
*/
defaultCharset?: string;

@@ -44,12 +72,35 @@ }

interface OptionsUrlencoded extends Options {
/**
* The extended option allows to choose between parsing the URL-encoded data
* with the querystring library (when `false`) or the qs library (when `true`).
*/
extended?: boolean;
/**
* The parameterLimit option controls the maximum number of parameters
* that are allowed in the URL-encoded data. If a request contains more parameters than this value,
* a 413 will be returned to the client. Defaults to 1000.
*/
parameterLimit?: number;
}
/**
* Returns middleware that only parses json and only looks at requests
* where the Content-Type header matches the type option.
*/
function json(options?: OptionsJson): NextHandleFunction;
/**
* Returns middleware that parses all bodies as a Buffer and only looks at requests
* where the Content-Type header matches the type option.
*/
function raw(options?: Options): NextHandleFunction;
/**
* Returns middleware that parses all bodies as a string and only looks at requests
* where the Content-Type header matches the type option.
*/
function text(options?: OptionsText): NextHandleFunction;
/**
* Returns middleware that only parses urlencoded bodies and only looks at requests
* where the Content-Type header matches the type option
*/
function urlencoded(options?: OptionsUrlencoded): NextHandleFunction;

@@ -56,0 +107,0 @@ }

+9
-4
{
"name": "@types/body-parser",
"version": "1.17.1",
"version": "1.19.0",
"description": "TypeScript definitions for body-parser",

@@ -36,6 +36,11 @@ "license": "MIT",

"githubUsername": "jwalton"
},
{
"name": "Piotr Błażejewicz",
"url": "https://github.com/peterblazejewicz",
"githubUsername": "peterblazejewicz"
}
],
"main": "",
"types": "index",
"types": "index.d.ts",
"repository": {

@@ -51,4 +56,4 @@ "type": "git",

},
"typesPublisherContentHash": "ada1b55777df6de5327f420d23285a5c476895faa88cacf6b80a1a791eef0f67",
"typeScriptVersion": "2.3"
"typesPublisherContentHash": "4257cff3580f6064eb283c690c28aa3a5347cd3cae2a2e208b8f23c61705724a",
"typeScriptVersion": "2.8"
}

@@ -8,10 +8,10 @@ # Installation

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser.
Additional Details
* Last updated: Mon, 19 Aug 2019 00:51:08 GMT
* Dependencies: @types/connect, @types/node
### Additional Details
* Last updated: Mon, 10 Feb 2020 21:19:04 GMT
* Dependencies: [@types/connect](https://npmjs.com/package/@types/connect), [@types/node](https://npmjs.com/package/@types/node)
* Global values: none
# Credits
These definitions were written 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>, and Jason Walton <https://github.com/jwalton>.
These definitions were written 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), and Piotr Błażejewicz (https://github.com/peterblazejewicz).