Skip to content

Exclude specific route from body-parsersing #633

@cesco69

Description

@cesco69

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions