Fixed server crash on GET /users/count

This commit is contained in:
DallonF
2012-12-14 08:55:08 -07:00
parent 5bcb00ecb6
commit a97ffd889d

View File

@@ -47,20 +47,21 @@ util.inherits(UserCollection, Collection);
*/
UserCollection.prototype.handle = function (ctx) {
var uc = this;
var uc = this
, handleArgs = arguments;
// set id one wasnt provided in the query
ctx.query.id = ctx.query.id || this.parseId(ctx) || (ctx.body && ctx.body.id);
if(ctx.method === 'POST' || ctx.query.id || ctx.url !== '/') {
handle.call(this);
handle.apply(this);
} else {
this.beforeQuery(ctx, handle.bind(this));
}
function handle() {
if (ctx.req.method == "GET" && (ctx.url === '/count' || ctx.url.indexOf('/index-of') === 0)) {
return Collection.prototype.handle.apply(uc, arguments);
return Collection.prototype.handle.apply(uc, handleArgs);
}
if(ctx.url === '/logout') {