Skip to content

Commit

Permalink
fix: implement does not related to dca1209
Browse files Browse the repository at this point in the history
  • Loading branch information
riflowth committed Apr 30, 2022
1 parent bbefd08 commit 16a65a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/controllers/ControllerRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ControllerRegistry {

const registerMiddleware = (middleware) => {
const canRegisterMiddleware = middleware
.getRegisterCondition()(routeMethod, routeMetadata);
.getRegisterCondition(routeMethod, routeMetadata);

if (canRegisterMiddleware) {
return middleware.getHandler(routeMetadata);
Expand Down
8 changes: 3 additions & 5 deletions test/mock/MockMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Middleware, MiddlewareCondition, RouteHandler } from '../..';
import { Methods, Middleware, RouteHandler, RouteMetadata } from '../..';

export class MockMiddleware extends Middleware {

Expand All @@ -18,10 +18,8 @@ export class MockConditionalMiddleware extends Middleware {
};
}

public getRegisterCondition(): MiddlewareCondition {
return (routeMethod, routeMetadata) => {
return routeMetadata.path === '/test2';
};
public getRegisterCondition(routeMethod: Methods, routeMetadata: RouteMetadata): boolean {
return routeMetadata.path === '/test2';
}

}

0 comments on commit 16a65a3

Please sign in to comment.