add fn assertion to app.use(). Closes #337
This commit is contained in:
parent
5fea250bcc
commit
7b3e3cbad5
1 changed files with 1 additions and 1 deletions
|
@ -96,7 +96,7 @@ app.toJSON = function(){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
app.use = function(fn){
|
app.use = function(fn){
|
||||||
assert('GeneratorFunction' == fn.constructor.name, 'app.use() requires a generator function');
|
assert(fn && 'GeneratorFunction' == fn.constructor.name, 'app.use() requires a generator function');
|
||||||
debug('use %s', fn._name || fn.name || '-');
|
debug('use %s', fn._name || fn.name || '-');
|
||||||
this.middleware.push(fn);
|
this.middleware.push(fn);
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue