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.

Bug: Wildcard example is not working

See original GitHub issue

Describe the bug

Wildcard rules don’t seem to be checked.

To Reproduce

Run the following code and make a request with an empty post:

const express = require('express')
const { check, sanitize, validationResult } = require('express-validator');

const app = express()
app.use(express.json());

const port = 3001

app.post('/', [
  check('addresses.*').isPostalCode(),
], (req, res) => {
  const errors = validationResult(req);
  if (!errors.isEmpty()) {
    return res.status(400).json({ errors: errors.array() });
  }

  res.send('Hello World!1')
});

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`)
})

Expected behavior

I expected some validation errors to pop out.

Current behavior

No errors.

Express-validator version:

  • Version: 6.6.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
fedecicommented, Jan 20, 2021

Sure, but you have to use a custom validator 😃

1reaction
fedecicommented, Oct 27, 2020

Hi, can you add also the body of the failing request, please? It would definitely help to understand better where the error comes from.

Read more comments on GitHub >

github_iconTop Results From Across the Web

* Wildcard not working in code search - Visual Studio Feedback
I'm trying to search all the words that contain "date" in a certain path. The * wildcard does not work as expected though....
Read more >
Is this unpredictable Word wildcard replace bug ever going to be
This bug appears regardless of whether View Markup is ON/OFF. For example in a numbered list, replacing a space after '.' to a...
Read more >
507074 – removing files using wildcard isn't working
Description of problem: I think there is a bug in "rm-rf" (possibly "rm" and "command" too) command. If I try to remove some...
Read more >
Wildcard grants do not work when partial-revokes is enabled
Suggested fix: Either make wildcards for regular grants actually work as documented also when partial-revokes is enabled, or update the ...
Read more >
Wildcard bug in FileZilla 1.1.0
The problem is that the behavior is often hardcoded and not changeable by the user. What harm would it do to implement it,...
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