🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

body-parser

Package Overview
Dependencies
Maintainers
3
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

body-parser - npm Package Compare versions

Comparing version
2.2.1
to
2.2.2
+6
-15
index.js

@@ -10,8 +10,7 @@ /*!

/**
* @typedef Parsers
* @type {function}
* @property {function} json
* @property {function} raw
* @property {function} text
* @property {function} urlencoded
* @typedef {Object} Parsers
* @property {Function} json JSON parser
* @property {Function} raw Raw parser
* @property {Function} text Text parser
* @property {Function} urlencoded URL-encoded parser
*/

@@ -21,5 +20,4 @@

* Module exports.
* @type {Parsers}
* @type {Function & Parsers}
*/
exports = module.exports = bodyParser

@@ -31,3 +29,2 @@

*/
Object.defineProperty(exports, 'json', {

@@ -43,3 +40,2 @@ configurable: true,

*/
Object.defineProperty(exports, 'raw', {

@@ -55,3 +51,2 @@ configurable: true,

*/
Object.defineProperty(exports, 'text', {

@@ -67,3 +62,2 @@ configurable: true,

*/
Object.defineProperty(exports, 'urlencoded', {

@@ -78,10 +72,7 @@ configurable: true,

*
* @param {object} [options]
* @return {function}
* @deprecated
* @public
*/
function bodyParser () {
throw new Error('The bodyParser() generic has been split into individual middleware to use instead.')
}

@@ -31,11 +31,10 @@ /*!

*
* @param {object} req
* @param {object} res
* @param {function} next
* @param {function} parse
* @param {function} debug
* @param {object} options
* @param {Object} req
* @param {Object} res
* @param {Function} next
* @param {Function} parse
* @param {Function} debug
* @param {Object} options
* @private
*/
function read (req, res, next, parse, debug, options) {

@@ -180,9 +179,8 @@ if (onFinished.isFinished(req)) {

*
* @param {object} req
* @param {function} debug
* @param {boolean} [inflate=true]
* @return {object}
* @api private
* @param {Object} req
* @param {Function} debug
* @param {boolean} inflate
* @returns {Object}
* @private
*/
function contentstream (req, debug, inflate) {

@@ -214,5 +212,5 @@ var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()

* @param {string} encoding
* @param {function} debug
* @return {object}
* @api private
* @param {Function} debug
* @returns {Object}
* @private
*/

@@ -241,7 +239,6 @@ function createDecompressionStream (encoding, debug) {

*
* @param {object} req
* @param {function} callback
* @api private
* @param {Object} req
* @param {Function} callback
* @private
*/
function dump (req, callback) {

@@ -248,0 +245,0 @@ if (onFinished.isFinished(req)) {

@@ -36,3 +36,2 @@ /*!

*/
var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex

@@ -46,7 +45,6 @@

*
* @param {object} [options]
* @return {function}
* @param {Object} [options]
* @returns {Function}
* @public
*/
function json (options) {

@@ -101,6 +99,5 @@ const normalizedOptions = normalizeOptions(options, 'application/json')

* @param {string} char
* @return {Error}
* @returns {Error}
* @private
*/
function createStrictSyntaxError (str, char) {

@@ -111,7 +108,3 @@ var index = str.indexOf(char)

if (index !== -1) {
partial = str.substring(0, index) + JSON_SYNTAX_CHAR
for (var i = index + 1; i < str.length; i++) {
partial += JSON_SYNTAX_CHAR
}
partial = str.substring(0, index) + JSON_SYNTAX_CHAR.repeat(str.length - index)
}

@@ -135,6 +128,5 @@

* @param {string} str
* @return {function}
* @returns {string|undefined}
* @private
*/
function firstchar (str) {

@@ -152,6 +144,6 @@ var match = FIRST_CHAR_REGEXP.exec(str)

* @param {SyntaxError} error
* @param {object} obj
* @return {SyntaxError}
* @param {Object} obj
* @returns {SyntaxError}
* @private
*/
function normalizeJsonSyntaxError (error, obj) {

@@ -158,0 +150,0 @@ var keys = Object.getOwnPropertyNames(error)

@@ -26,7 +26,6 @@ /*!

*
* @param {object} [options]
* @return {function}
* @api public
* @param {Object} [options]
* @returns {Function}
* @public
*/
function raw (options) {

@@ -33,0 +32,0 @@ const normalizedOptions = normalizeOptions(options, 'application/octet-stream')

@@ -26,7 +26,6 @@ /*!

*
* @param {object} [options]
* @return {function}
* @api public
* @param {Object} [options]
* @returns {Function}
* @public
*/
function text (options) {

@@ -33,0 +32,0 @@ const normalizedOptions = normalizeOptions(options, 'text/plain')

@@ -30,7 +30,6 @@ /*!

*
* @param {object} [options]
* @return {function}
* @param {Object} [options]
* @returns {Function}
* @public
*/
function urlencoded (options) {

@@ -66,5 +65,6 @@ const normalizedOptions = normalizeOptions(options, 'application/x-www-form-urlencoded')

*
* @param {object} options
* @param {Object} options
* @returns {Function}
* @private
*/
function createQueryParser (options) {

@@ -101,3 +101,3 @@ var extended = Boolean(options?.extended)

var arrayLimit = extended ? Math.max(100, paramCount) : 0
var arrayLimit = extended ? Math.max(100, paramCount) : paramCount

@@ -133,4 +133,4 @@ debug('parse ' + (extended ? 'extended ' : '') + 'urlencoding')

* @param {number} limit
* @return {number|undefined} Returns undefined if limit exceeded
* @api private
* @returns {number|undefined} Returns undefined if limit exceeded
* @private
*/

@@ -137,0 +137,0 @@ function parameterCount (body, limit) {

@@ -23,6 +23,6 @@ 'use strict'

*
* @param {object} req
* @api private
* @param {Object} req
* @returns {string | undefined}
* @private
*/
function getCharset (req) {

@@ -40,5 +40,5 @@ try {

* @param {string | string[]} type
* @return {function}
* @returns {Function}
* @private
*/
function typeChecker (type) {

@@ -53,5 +53,6 @@ return function checkType (req) {

*
* @param {object} options options to normalize
* @param {string | string[] | function} defaultType default content type(s) or a function to determine it
* @returns {object}
* @param {Object} options options to normalize
* @param {string | string[] | Function} defaultType default content type(s) or a function to determine it
* @returns {Object}
* @private
*/

@@ -95,3 +96,4 @@ function normalizeOptions (options, defaultType) {

* @param {*} value
* @return {*}
* @returns {*}
* @private
*/

@@ -98,0 +100,0 @@ function passthrough (value) {

{
"name": "body-parser",
"description": "Node.js body parsing middleware",
"version": "2.2.1",
"version": "2.2.2",
"contributors": [

@@ -22,3 +22,3 @@ "Douglas Christopher Wilson <doug@somethingdoug.com>",

"on-finished": "^2.4.1",
"qs": "^6.14.0",
"qs": "^6.14.1",
"raw-body": "^3.0.1",

@@ -25,0 +25,0 @@ "type-is": "^2.0.1"

+18
-18

@@ -20,3 +20,3 @@ # body-parser

[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/).
[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/learn/http/anatomy-of-an-http-transaction).

@@ -27,8 +27,8 @@ _This does not handle multipart bodies_, due to their complex and typically

* [busboy](https://www.npmjs.org/package/busboy#readme) and
[connect-busboy](https://www.npmjs.org/package/connect-busboy#readme)
* [multiparty](https://www.npmjs.org/package/multiparty#readme) and
[connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme)
* [formidable](https://www.npmjs.org/package/formidable#readme)
* [multer](https://www.npmjs.org/package/multer#readme)
* [busboy](https://www.npmjs.com/package/busboy#readme) and
[connect-busboy](https://www.npmjs.com/package/connect-busboy#readme)
* [multiparty](https://www.npmjs.com/package/multiparty#readme) and
[connect-multiparty](https://www.npmjs.com/package/connect-multiparty#readme)
* [formidable](https://www.npmjs.com/package/formidable#readme)
* [multer](https://www.npmjs.com/package/multer#readme)

@@ -44,4 +44,4 @@ This module provides the following parsers:

- [body](https://www.npmjs.org/package/body#readme)
- [co-body](https://www.npmjs.org/package/co-body#readme)
- [body](https://www.npmjs.com/package/body#readme)
- [co-body](https://www.npmjs.com/package/co-body#readme)

@@ -115,3 +115,3 @@ ## Installation

function, `type` option is passed directly to the
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
[type-is](https://www.npmjs.com/package/type-is#readme) library and this can
be an extension name (like `json`), a mime type (like `application/json`), or

@@ -161,3 +161,3 @@ a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type`

If not a function, `type` option is passed directly to the
[type-is](https://www.npmjs.org/package/type-is#readme) library and this
[type-is](https://www.npmjs.com/package/type-is#readme) library and this
can be an extension name (like `bin`), a mime type (like

@@ -213,3 +213,3 @@ `application/octet-stream`), or a mime type with a wildcard (like `*/*` or

a function, `type` option is passed directly to the
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
[type-is](https://www.npmjs.com/package/type-is#readme) library and this can
be an extension name (like `txt`), a mime type (like `text/plain`), or a mime

@@ -230,4 +230,4 @@ type with a wildcard (like `*/*` or `text/*`). If a function, the `type`

requests where the `Content-Type` header matches the `type` option. This
parser accepts only UTF-8 encoding of the body and supports automatic
inflation of `gzip`, `br` (brotli) and `deflate` encodings.
parser accepts only UTF-8 and ISO-8859-1 encodings of the body and supports
automatic inflation of `gzip`, `br` (brotli) and `deflate` encodings.

@@ -249,3 +249,3 @@ A new `body` object containing the parsed data is populated on the `request`

more information, please [see the qs
library](https://www.npmjs.org/package/qs#readme).
library](https://www.npmjs.com/package/qs#readme).

@@ -277,3 +277,3 @@ Defaults to `false`.

a function, `type` option is passed directly to the
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
[type-is](https://www.npmjs.com/package/type-is#readme) library and this can
be an extension name (like `urlencoded`), a mime type (like

@@ -500,5 +500,5 @@ `application/x-www-form-urlencoded`), or a mime type with a wildcard (like

[npm-downloads-image]: https://img.shields.io/npm/dm/body-parser
[npm-url]: https://npmjs.org/package/body-parser
[npm-url]: https://npmjs.com/package/body-parser
[npm-version-image]: https://img.shields.io/npm/v/body-parser
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/body-parser/badge
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser