@@ -123,7 +123,7 @@ export class PathRoute<
123123 #params?: Params ;
124124 #paramKeys: Key [ ] ;
125125 #path: Path ;
126- #regex : RegExp & { keys : Key [ ] } ;
126+ #regexp : RegExp ;
127127 #schema: Schema < QSSchema , BSchema , ResSchema > ;
128128
129129 /**
@@ -154,7 +154,7 @@ export class PathRoute<
154154 * The path pattern that has been converted into {@linkcode RegExp}.
155155 */
156156 get regex ( ) : RegExp {
157- return this . #regex ;
157+ return this . #regexp ;
158158 }
159159
160160 /**
@@ -189,8 +189,9 @@ export class PathRoute<
189189 this . #handler = handler ;
190190 this . #keys = keys ;
191191 this . #expose = expose ;
192- this . #regex = pathToRegexp ( path , { ...options , strict : true } ) ;
193- this . #paramKeys = this . #regex. keys ;
192+ const { regexp, keys : paramKeys } = pathToRegexp ( path , { ...options } ) ;
193+ this . #regexp = regexp ;
194+ this . #paramKeys = paramKeys ;
194195 this . #logger = getLogger ( "acorn.route" ) ;
195196 this . #logger
196197 . debug ( `created route with path: ${ path } and methods: ${ methods } ` ) ;
@@ -268,7 +269,7 @@ export class PathRoute<
268269 * Determines if the request should be handled by the route.
269270 */
270271 matches ( method : HttpMethod , pathname : string ) : boolean | NotAllowed {
271- const match = pathname . match ( this . #regex ) ;
272+ const match = pathname . match ( this . #regexp ) ;
272273 if ( match ) {
273274 if ( ! this . #methods. includes ( method ) ) {
274275 return NOT_ALLOWED ;
@@ -297,7 +298,7 @@ export class PathRoute<
297298 inspect ( {
298299 params : this . #params,
299300 path : this . #path,
300- regex : this . #regex ,
301+ regex : this . #regexp ,
301302 schema : this . #schema,
302303 } )
303304 } `;
@@ -321,7 +322,7 @@ export class PathRoute<
321322 inspect ( {
322323 params : this . #params,
323324 path : this . #path,
324- regex : this . #regex ,
325+ regex : this . #regexp ,
325326 schema : this . #schema,
326327 } , newOptions )
327328 } `;
0 commit comments