conditional middleware need to be `.call(this)`
just realized this since we removed the top closure. i'm not sure if there's a better way to solve this, but i'd rather have this inconvenience than the extra closures. we should add tests!!!master
parent
d23ad1a024
commit
98548f0409
|
@ -21,7 +21,7 @@ function ignoreAssets(mw) {
|
|||
if (/(\.js|\.css|\.ico)$/.test(this.path)) {
|
||||
yield next;
|
||||
} else {
|
||||
yield mw(next);
|
||||
yield mw.call(this, next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ app.use(function *(next){
|
|||
yield next;
|
||||
} else {
|
||||
this.body = 'Hello World';
|
||||
yield logger(next);
|
||||
yield logger.call(this, next);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue