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)) {
|
if (/(\.js|\.css|\.ico)$/.test(this.path)) {
|
||||||
yield next;
|
yield next;
|
||||||
} else {
|
} else {
|
||||||
yield mw(next);
|
yield mw.call(this, next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ app.use(function *(next){
|
||||||
yield next;
|
yield next;
|
||||||
} else {
|
} else {
|
||||||
this.body = 'Hello World';
|
this.body = 'Hello World';
|
||||||
yield logger(next);
|
yield logger.call(this, next);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue