Skip to content

Commit 0649425

Browse files
committed
fixed tests
1 parent 7352ae2 commit 0649425

File tree

6 files changed

+341
-238
lines changed

6 files changed

+341
-238
lines changed

packages/event-handler/src/http/Route.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import type {
77
TypedRouteHandler,
88
} from '../types/http.js';
99

10-
class Route<TReqBody = never, TResBody extends HandlerResponse = HandlerResponse> {
10+
class Route<
11+
TReqBody = never,
12+
TResBody extends HandlerResponse = HandlerResponse,
13+
> {
1114
readonly id: string;
1215
readonly method: string;
1316
readonly path: Path;

packages/event-handler/src/http/RouteHandlerRegistry.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {
66
HttpMethod,
77
HttpRouteHandlerOptions,
88
Path,
9+
RouteHandler,
910
RouteRegistryOptions,
1011
ValidationResult,
1112
} from '../types/http.js';
@@ -95,7 +96,10 @@ class RouteHandlerRegistry {
9596
*
9697
* @param route - The route to register
9798
*/
98-
public register<TReqBody = never, TResBody extends HandlerResponse = HandlerResponse>(route: Route<TReqBody, TResBody>): void {
99+
public register<
100+
TReqBody = never,
101+
TResBody extends HandlerResponse = HandlerResponse,
102+
>(route: Route<TReqBody, TResBody>): void {
99103
this.#shouldSort = true;
100104
const { isValid, issues } = validatePathPattern(route.path);
101105
if (!isValid) {
@@ -180,7 +184,7 @@ class RouteHandlerRegistry {
180184
const staticRoute = this.#staticRoutes.get(routeId);
181185
if (staticRoute != null) {
182186
return {
183-
handler: staticRoute.handler,
187+
handler: staticRoute.handler as RouteHandler,
184188
rawParams: {},
185189
params: {},
186190
middleware: staticRoute.middleware,
@@ -242,7 +246,7 @@ class RouteHandlerRegistry {
242246
}
243247

244248
return {
245-
handler: route.handler,
249+
handler: route.handler as RouteHandler,
246250
params: processedParams,
247251
rawParams: params,
248252
middleware: route.middleware,

0 commit comments

Comments
 (0)