Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the returned err.name contains spaces #294

Open
ikexing-cn opened this issue May 24, 2022 · 0 comments
Open

the returned err.name contains spaces #294

ikexing-cn opened this issue May 24, 2022 · 0 comments

Comments

@ikexing-cn
Copy link

ikexing-cn commented May 24, 2022

Description

the returned err.name contains spaces.

Reproduction

app.use(expressjwt({
    secret: SECRET,
    algorithms: ['HS256']
}).unless({ path: unlesses }))

app.use((err, req, res, next) => {
    if (err.name. === 'TokenExpiredError') {
        console.log(1)
    } else {
        console.log(2)
    }
})

if it is the above code, the log is always 2.
but once you change it to err.name.trim(), everything works fine...

Environment

Please provide the following:

  • **Version of this library used: 7.7.2
  • **Version of the platform or framework used, if applicable: express
  • **Other relevant versions (language, server software, OS, browser): javascript / nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant