question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is the parameter req passed to matchedData used ?

See original GitHub issue

Hi,

Since i updated to 6.1.0 (no problem in 5.3.1), the req.body fields are immutable after calling their middleware validator. It looks like the parameter req passed to matchedData at the call is not used.

Example :

HTTP POST Request :

{
    "visible": "on"
}

Middleware :

body('visible', ' ') // From here, changes to req.body property "visible" won't be considered by matchedData(req);
    .custom(/* some code */),

function (req, res, next) {
    req.body.visible = false; // value 'on' sent by the client in the HTTP POST changed to false
    console.log(req.body.visible); // will display false
    req.body = matchedData(req);
    console.log(req.body.visible); // will display 'on' if no error
}

I would like to know if it is the expected behavior ? It is linked with using Symbol ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
BigFaxcommented, Jul 1, 2019

Ok, it’s clear now. Thank you 😃

0reactions
lock[bot]commented, Aug 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

matchedData() - express-validator
Gathering data from multiple locations. If data you validated or sanitized is spread across various request locations (e.g. req.body , req.query , req...
Read more >
Express Validator Error: expressValidator is not a function
Express Validator has been updated therefore, you can't use it this way This is a new way to use the express validator.
Read more >
Discussion of A Clean Approach to Using Express Validator
I recently used express validator in a project ... Read full post ... matchedData = matchedData(req); return next(); } const extractedErrors ...
Read more >
Troubleshoot - Azure Web Application Firewall - Microsoft Learn
The first one says it matched because the user used a numeric/IP URL for the request, which increases the anomaly score by three...
Read more >
Logging web ACL traffic - AWS Documentation
Logged information includes the time that AWS WAF received a web request from your AWS resource, detailed information about the request, and details...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found