• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / blurts-server / 626ef5b8-5a47-4baa-83a1-b284f02b4dbb

pending completion
626ef5b8-5a47-4baa-83a1-b284f02b4dbb

push

circleci

GitHub
Merge pull request #2735 from mozilla/MNTOR-976

278 of 1106 branches covered (25.14%)

Branch coverage included in aggregate %.

29 of 29 new or added lines in 5 files covered. (100.0%)

948 of 2981 relevant lines covered (31.8%)

5.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/middleware/util.js
1
// Helps handle errors for all async route controllers
2
// See https://medium.com/@Abazhenov/using-async-await-in-express-with-node-8-b8af872c0016
3
function asyncMiddleware (fn) {
4
  return (req, res, next) => {
×
5
    Promise.resolve(fn(req, res, next)).catch(next)
×
6
  }
7
}
8

9
function bearerToken (req, res, next) {
10
  const [type, token] = req.headers.authorization?.split(' ') || []
×
11
  if (type && type === 'Bearer') {
×
12
    req.token = token
×
13
  } else if (req.query && req.query.token) {
×
14
    req.token = req.query.token
×
15
  }
16
  next()
×
17
}
18

19
export { asyncMiddleware, bearerToken }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc