Makes sure routes don't overlap and yield a header set error (#2559)

This commit is contained in:
Florent Vilmart
2016-08-21 13:57:12 -04:00
committed by GitHub
parent 9ab488b6a0
commit 23e47f2e28
4 changed files with 13 additions and 9 deletions

View File

@@ -18,6 +18,9 @@ export class UsersRouter extends ClassesRouter {
}
handleGet(req) {
if (req.params.objectId === 'me') {
return this.handleMe(req);
}
req.params.className = '_User';
return super.handleGet(req);
}
@@ -198,7 +201,6 @@ export class UsersRouter extends ClassesRouter {
mountRoutes() {
this.route('GET', '/users', req => { return this.handleFind(req); });
this.route('POST', '/users', req => { return this.handleCreate(req); });
this.route('GET', '/users/me', req => { return this.handleMe(req); });
this.route('GET', '/users/:objectId', req => { return this.handleGet(req); });
this.route('PUT', '/users/:objectId', req => { return this.handleUpdate(req); });
this.route('DELETE', '/users/:objectId', req => { return this.handleDelete(req); });