npm.io
11.0.5 • Published 2 weeks ago

@adonisjs/bodyparser

Licence
MIT
Version
11.0.5
Deps
9
Size
97 kB
Vulns
0
Weekly
0
Stars
35

@adonisjs/bodyparser


gh-workflow-image npm-image license-image

Introduction

This repo provides the BodyParser middleware to process AdonisJS HTTP request body. The middleware has parsers for JSON, URLencoded form, and Multipart content types.

Official Documentation

The documentation is available on the AdonisJS website

Parsed JSON bodies have no nesting depth limit by default. Set json.maxDepth to limit nested objects and arrays, counting the root container as level 1:

defineConfig({
  json: {
    maxDepth: 100,
  },
})

The limit is checked after safeParse removes prototype-poisoning properties, so discarded subtrees do not count toward the limit. Deeper parsed bodies return HTTP 400, with or without string normalization and regardless of strict mode. Without a limit, deeply nested bodies may still exceed the stack limits of downstream operations.

Benchmarks

Run npm run benchmark:json to measure JSON parsing with string normalization enabled. See benchmark methodology.

Contributing

One of the primary goals of AdonisJS is to have a vibrant community of users and contributors who believes in the principles of the framework.

We encourage you to read the contribution guide before contributing to the framework.

Code of Conduct

In order to ensure that the AdonisJS community is welcoming to all, please review and abide by the Code of Conduct.

License

AdonisJS Bodyparser is open-sourced software licensed under the MIT license.

Keywords