expressjs / expressjs/body-parser

set req.length

Open
#214 14 comments 0 reactions 0 assignees View on GitHub
ideas
Dominant language
JavaScript
Stars
5.5k
Forks
767
Avg merge
13h 53m
Merged PRs (30d)
10

Description

it would be nice that body-parser sets the length of the body, my use case is I'd like to know the length of a JSON payload POSTED using chunked-encoding, so there is no content-length header and req.body is set to an Object thanks to body-parser.

Sounds like the only way to get the body size is to stringify req.body and get the length :/ or use raw-parser and JSON.parse.

Any chance we could set req.length or similar to the size of the raw body before parsing it ? (other suggestions are welcome)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.