Skip to content

Commit 857262e

Browse files
committed
simplified the regex
1 parent 838f77d commit 857262e

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class RouteHandlerRegistry {
104104

105105
const compiled = compilePath(route.path);
106106

107-
if (/[\w/:-]/.test(compiled.path)) {
107+
if (!/^[\w+/:-]+$/.test(compiled.path)) {
108108
if (this.#regexRoutes.has(route.id)) {
109109
this.#logger.warn(
110110
`Handler for method: ${route.method} and path: ${route.path} already exists. The previous handler will be replaced.`

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,9 @@ type RestRouteOptions = {
7979
middleware?: Middleware[];
8080
};
8181

82-
// biome-ignore lint/suspicious/noConfusingVoidType: To ensure next function is awaited
83-
type NextFunction = () =>
84-
| Promise<HandlerResponse | void>
85-
| HandlerResponse
86-
| void;
82+
type NextFunction =
83+
() => // biome-ignore lint/suspicious/noConfusingVoidType: To ensure next function is awaited
84+
Promise<HandlerResponse | void> | HandlerResponse | void;
8785

8886
type Middleware = (args: {
8987
reqCtx: RequestContext;

0 commit comments

Comments
 (0)