Skip to content

Commit bf576e2

Browse files
committed
reverted changes in the compose middleware function
1 parent 167c4ec commit bf576e2

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

packages/event-handler/src/rest/utils.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import type {
55
HandlerResponse,
66
HttpMethod,
77
Middleware,
8-
NextFunction,
98
Path,
10-
RequestContext,
119
ValidationResult,
1210
} from '../types/rest.js';
1311
import {
@@ -151,14 +149,8 @@ export const isAPIGatewayProxyResult = (
151149
* // -> middleware1 end
152150
* ```
153151
*/
154-
export const composeMiddleware = (middleware: Middleware[]) => {
155-
return async ({
156-
reqCtx,
157-
next,
158-
}: {
159-
reqCtx: RequestContext;
160-
next: NextFunction;
161-
}) => {
152+
export const composeMiddleware = (middleware: Middleware[]): Middleware => {
153+
return async ({ reqCtx, next }) => {
162154
let index = -1;
163155
let result: HandlerResponse | undefined;
164156

@@ -201,6 +193,6 @@ export const composeMiddleware = (middleware: Middleware[]) => {
201193
};
202194

203195
await dispatch(0);
204-
if (result !== undefined) return result;
196+
return result;
205197
};
206198
};

0 commit comments

Comments
 (0)