Skip to content

Commit e890802

Browse files
authored
For consistency and bugs (#40)
1 parent 9f7c15d commit e890802

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ if(corsAllowedOrigins !== "*") {
9090
// No CORS for you.
9191
res.removeHeader("Access-Control-Allow-Origin")
9292
}
93-
next()
93+
return next()
9494
})
9595
}
9696

@@ -110,7 +110,7 @@ app.use('/app/overwrite', overwriteRouter)
110110

111111
// catch 404 and forward to error handler
112112
app.use(function(req, res, next) {
113-
next(createError(404))
113+
return next(createError(404))
114114
})
115115

116116
// error handler

tokens.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,18 @@ async function checkAccessToken(req, res, next) {
6363
// If the instance of TinyPen is not registered and does not have a token then there is nothing to check.
6464
// Move on through the middleware. RERUM will tell you what you did wrong.
6565
if(!process?.env?.ACCESS_TOKEN) {
66-
next()
67-
return
66+
return next()
6867
}
6968
if (isTokenExpired(process.env.ACCESS_TOKEN)) {
7069
console.log("TinyPen detected an expired access token. Updating the token now.")
7170
await generateNewAccessToken()
7271
}
73-
next()
72+
return next()
7473
}
7574
catch (err) {
7675
console.log("TinyPen encountered an error trying to refresh its access token")
7776
console.error(err)
78-
next(err)
77+
return next(err)
7978
}
8079

8180
}

0 commit comments

Comments
 (0)