Socket
Socket
Sign inDemoInstall

body-parser

Package Overview
Dependencies
5
Maintainers
6
Versions
72
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.2 to 1.3.0

5

HISTORY.md

@@ -0,1 +1,6 @@

1.3.0 / 2014-05-31
==================
* add `extended` option to urlencoded parser
1.2.2 / 2014-05-27

@@ -2,0 +7,0 @@ ==================

8

index.js

@@ -7,2 +7,3 @@

var qs = require('qs');
var querystring = require('querystring');

@@ -85,2 +86,3 @@ var firstcharRegExp = /^\s*(.)/

var extended = options.extended !== false
var limit = typeof options.limit !== 'number'

@@ -96,5 +98,9 @@ ? bytes(options.limit || '100kb')

var queryparse = extended
? qs.parse
: querystring.parse
function parse(str) {
return str.length
? qs.parse(str)
? queryparse(str)
: {}

@@ -101,0 +107,0 @@ }

7

package.json
{
"name": "body-parser",
"description": "Node.js body parsing middleware",
"version": "1.2.2",
"version": "1.3.0",
"author": {

@@ -26,2 +26,3 @@ "name": "Jonathan Ong",

"devDependencies": {
"istanbul": "0.2.10",
"mocha": "~1.18.2",

@@ -35,4 +36,6 @@ "should": "~3.3.1",

"scripts": {
"test": "mocha --require should --reporter spec --bail"
"test": "mocha --require should --reporter dot",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec"
}
}

@@ -1,3 +0,7 @@

# body-parser [![Build Status](https://travis-ci.org/expressjs/body-parser.svg?branch=master)](https://travis-ci.org/expressjs/body-parser) [![NPM version](https://badge.fury.io/js/body-parser.svg)](https://badge.fury.io/js/body-parser)
# body-parser
[![NPM version](https://badge.fury.io/js/body-parser.svg)](https://badge.fury.io/js/body-parser)
[![Build Status](https://travis-ci.org/expressjs/body-parser.svg?branch=master)](https://travis-ci.org/expressjs/body-parser)
[![Coverage Status](https://img.shields.io/coveralls/expressjs/body-parser.svg?branch=master)](https://coveralls.io/r/expressjs/body-parser)
Node.js body parsing middleware.

@@ -8,11 +12,11 @@

- [busboy](https://github.com/mscdex/busboy) and [connect-busboy](https://github.com/mscdex/connect-busboy)
- [multiparty](https://github.com/andrewrk/node-multiparty) and [connect-multiparty](https://github.com/andrewrk/connect-multiparty)
- [formidable](https://github.com/felixge/node-formidable)
- [multer](https://github.com/expressjs/multer)
- [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)
Other body parsers you might be interested in:
- [body](https://github.com/raynos/body)
- [co-body](https://github.com/visionmedia/co-body)
- [body](https://www.npmjs.org/package/body#readme)
- [co-body](https://www.npmjs.org/package/co-body#readme)

@@ -60,3 +64,3 @@ ## Installation

The `type` argument is passed directly to the [type-is](https://github.com/expressjs/type-is) library. This can be an extension name (like `json`), a mime type (like `application/json`), or a mime time with a wildcard (like `*/json`).
The `type` argument is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) library. This can be an extension name (like `json`), a mime type (like `application/json`), or a mime time with a wildcard (like `*/json`).

@@ -69,4 +73,5 @@ The `verify` argument, 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. The parsing can be aborted by throwing an error.

Returns middleware that only parses `urlencoded` with the [qs](https://github.com/visionmedia/node-querystring) module. The options are:
Returns middleware that only parses `urlencoded` bodies. The options are:
- `extended` - parse extended syntax with the [qs](https://www.npmjs.org/package/qs#readme) module. (default: `true`)
- `limit` - maximum request body size. (default: `<100kb>`)

@@ -76,4 +81,6 @@ - `type` - request content-type to parse (default: `urlencoded`)

The `type` argument is passed directly to the [type-is](https://github.com/expressjs/type-is) library. This can be an extension name (like `urlencoded`), a mime type (like `application/x-www-form-urlencoded`), or a mime time with a wildcard (like `*/x-www-form-urlencoded`).
The `extended` argument allows to choose between parsing the urlencoded data with the `querystring` library (when `false`) or the `qs` library (when `true`). The "extended" syntax allows for rich objects and arrays to be encoded into the urlencoded format, allowing for a JSON-like exterience with urlencoded. For more information, please [see the qs library](https://www.npmjs.org/package/qs#readme).
The `type` argument is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) library. This can be an extension name (like `urlencoded`), a mime type (like `application/x-www-form-urlencoded`), or a mime time with a wildcard (like `*/x-www-form-urlencoded`).
The `verify` argument, 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. The parsing can be aborted by throwing an error.

@@ -80,0 +87,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc