express-jwt icon indicating copy to clipboard operation
express-jwt copied to clipboard

the returned `err.name` contains spaces

Open ikexing-cn opened this issue 2 years ago • 0 comments

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

ikexing-cn avatar May 24 '22 08:05 ikexing-cn