Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

Commit

Permalink
fix(lifecycle): Fix issue where methods without middleware were not r…
Browse files Browse the repository at this point in the history
…egistering
  • Loading branch information
zakhenry committed Jun 16, 2016
1 parent 20f71a5 commit 12a7393
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/controllers/abstract.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ export abstract class AbstractController {

let callStack: PromiseFactory<Response>[] = [];

callStack.push(this[methodSignature]);

if (this.registeredMiddleware){
const methodMiddlewareFactories = this.registeredMiddleware.methods.get(methodSignature);
//wrap method registered factories with the class defined ones
methodMiddlewareFactories.before.unshift(...this.registeredMiddleware.all.before);
methodMiddlewareFactories.after.push(...this.registeredMiddleware.all.after);

callStack.push(this[methodSignature]);

if (methodMiddlewareFactories) {
callStack.unshift(...methodMiddlewareFactories.before.map((middleware: MiddlewareFactory) => middleware(this.injector)));
callStack.push(...methodMiddlewareFactories.after.map((middleware: MiddlewareFactory) => middleware(this.injector)));
Expand Down

0 comments on commit 12a7393

Please sign in to comment.