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
Jonathan Ong 2013-11-14 21:20:51 -08:00
parent d23ad1a024
commit 98548f0409
2 changed files with 2 additions and 2 deletions

View File

@ -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);
}
}
}

View File

@ -20,7 +20,7 @@ app.use(function *(next){
yield next;
} else {
this.body = 'Hello World';
yield logger(next);
yield logger.call(this, next);
}
});