UNPKG

heroku-debug

Version:
13 lines (10 loc) 288 B
'use strict' const user = require('../lib/user') module.exports = function * (next) { if (this.headers.authorization) { let token = this.headers.authorization.split(' ')[1] this.username = yield user.findByToken(token) } if (!this.username) this.throw(401) yield next }