Node.js body parsing middleware. Parse incoming request bodies in a middleware before your handlers, available under the req.body property. As req.body's shape is based on user-controlled input, all properties and values in this object are untrusted and should be validated before trusting. For example, req.body.foo.toString() may fail in multiple ways, for example the foo property may not be there or may not be a string, and toString may not be a function and instead a string or other user input. The bodyParser object exposes various factories to create middlewares. All middlewares will populate the req.body property with the parsed body when the Content-Type request header matches the type option, or an empty object ({}) if there was no body to parse, the Content-Type was not matched, or an error occurred.

Features

  • Control the maximum request body size
  • Add a generic JSON and URL-encoded parser as a top-level middleware
  • Add body parsers specifically to the routes that need them
  • Parse the bodies of all incoming requests
  • All the parsers accept a type option which allows you to change the Content-Type that the middleware will parse
  • Change accepted type for parsers

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow body-parser

body-parser Web Site

You Might Also Like
Vivantio IT Service Management Icon
Vivantio IT Service Management

Your service operation isn’t one-size-fits all, so your IT service management solution shouldn’t be either

The Vivantio Platform allows you to focus on the IT service management tools that make sense for your organization’s unique service model: from incident, problem and change requests, to service requests, client knowledge and asset management
Learn More

User Reviews

Be the first to post a review of body-parser!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Parser Generators

Registered

2021-11-01