use arrow fn to avoid var self = this
This commit is contained in:
parent
ed19e67055
commit
91ecce1d76
1 changed files with 2 additions and 3 deletions
|
@ -119,13 +119,12 @@ app.callback = function(){
|
|||
const fn = this.experimental
|
||||
? compose_es7(this.middleware)
|
||||
: co.wrap(compose(this.middleware));
|
||||
const self = this;
|
||||
|
||||
if (!this.listeners('error').length) this.on('error', this.onerror);
|
||||
|
||||
return function(req, res){
|
||||
return (req, res) => {
|
||||
res.statusCode = 404;
|
||||
const ctx = self.createContext(req, res);
|
||||
const ctx = this.createContext(req, res);
|
||||
onFinished(res, ctx.onerror);
|
||||
fn.call(ctx).then(function () {
|
||||
respond.call(ctx);
|
||||
|
|
Loading…
Reference in a new issue