expressjs / expressjs/body-parser

Exclude specific route from body-parsersing

Open
#633 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
5.5k
Forks
767
Avg merge
13h 53m
Merged PRs (30d)
10

Description

Hi, in the 1.X versione there is https://github.com/expressjs/body-parser/blob/1.x/lib/read.js#L45-L46
```js
// flag as parsed
req._body = true
```
I have used this flag for exclude a specific route from body parsersing, eg.:
```js
app.use((req, res, next) => {
if ( /^\/api\/wopi\/files\/([a-zA-Z0-9]+)\/contents$/.test(req.path.toLowerCase()) ) {
req['_body'] = true;
}
next();
});
```

In the 2.X version this flag disappear... How can I exclude a specific route from body parser?

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.