mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-05-15 09:37:53 +08:00
Fixed server crash on GET /users/count
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user