Exclude specific route from body-parsersing

Open
#633 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
javascript, node.js
Domain
backend

Research direction

Start by comparing the referenced 1.x lib/read.js lines 45-46 with the corresponding 2.x parsing path, then trace how the supplied route middleware reaches the parser. Done means establishing and documenting a supported way to exclude that route, or clearly defining the missing feature and its tests.

Written by the indexing model from the issue text.

Description

question

Hi, in the 1.X versione there is https://github.com/expressjs/body-parser/blob/1.x/lib/read.js#L45-L46

  // flag as parsed
  req._body = true

I have used this flag for exclude a specific route from body parsersing, eg.:

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?

Dominant language
JavaScript
Stars
5.5k
Forks
802
Avg merge
7h 54m
Merged PRs (30d)
8

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from expressjs/body-parser

All issues in expressjs/body-parser

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.