File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
packages/event-handler/src/rest Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -243,9 +243,9 @@ class Router {
243
243
) ;
244
244
} else {
245
245
const handler =
246
- options ?. scope ! = null
247
- ? route . handler . bind ( options . scope )
248
- : route . handler ;
246
+ options ?. scope = = null
247
+ ? route . handler
248
+ : route . handler . bind ( options . scope ) ;
249
249
250
250
const handlerResult = await handler ( params , reqCtx ) ;
251
251
reqCtx . res = handlerResultToWebResponse (
@@ -286,12 +286,10 @@ class Router {
286
286
public route ( handler : RouteHandler , options : RestRouteOptions ) : void {
287
287
const { method, path, middleware = [ ] } = options ;
288
288
const methods = Array . isArray ( method ) ? method : [ method ] ;
289
- const resolvedPath : Path =
290
- this . prefix === undefined
291
- ? path
292
- : path === '/'
293
- ? this . prefix
294
- : `${ this . prefix } ${ path } ` ;
289
+ let resolvedPath = path ;
290
+ if ( this . prefix ) {
291
+ resolvedPath = path === '/' ? this . prefix : `${ this . prefix } ${ path } ` ;
292
+ }
295
293
296
294
for ( const method of methods ) {
297
295
this . routeRegistry . register (
You can’t perform that action at this time.
0 commit comments