File tree Expand file tree Collapse file tree 4 files changed +26
-7
lines changed Expand file tree Collapse file tree 4 files changed +26
-7
lines changed Original file line number Diff line number Diff line change 1
1
# 1.2.24 - 2 Mar 2025
2
2
Bug fix:
3
3
- 200 object response is not inferring type in type-level
4
- -
4
+ - [ # 1091 ] ( https://github.com/elysiajs/elysia/issues/1091 ) route is not defined when using trace
5
5
6
6
# 1.2.23 - 25 Feb 2025
7
7
Bug fix:
Original file line number Diff line number Diff line change @@ -10,11 +10,9 @@ const app = new Elysia().get(
10
10
}
11
11
} ,
12
12
{
13
- response : {
14
- 200 : t . Object ( {
15
- name : t . String ( )
16
- } )
17
- }
13
+ response : t . Object ( {
14
+ name : t . String ( )
15
+ } )
18
16
}
19
17
)
20
18
Original file line number Diff line number Diff line change @@ -1013,7 +1013,7 @@ export const composeHandler = ({
1013
1013
? `,${ adapter . mapResponseContext } `
1014
1014
: ''
1015
1015
1016
- if ( inference . route ) fnLiteral += `c.route=\`${ path } \`\n`
1016
+ if ( hasTrace || inference . route ) fnLiteral += `c.route=\`${ path } \`\n`
1017
1017
1018
1018
const parseReporter = report ( 'parse' , {
1019
1019
total : hooks . parse ?. length
Original file line number Diff line number Diff line change @@ -422,4 +422,25 @@ describe('trace', () => {
422
422
423
423
expect ( isCalled ) . toBeTrue ( )
424
424
} )
425
+
426
+ it ( 'report route when using trace' , async ( ) => {
427
+ let route : string | undefined
428
+
429
+ const app = new Elysia ( )
430
+ . trace ( ( { onHandle, context } ) => {
431
+ onHandle ( ( { onStop } ) => {
432
+ onStop ( ( { error } ) => {
433
+ route = context . route
434
+ expect ( error ) . toBeInstanceOf ( Error )
435
+ } )
436
+ } )
437
+ } )
438
+ . get ( '/id/:id' , ( ) => {
439
+ throw new Error ( 'A' )
440
+ } )
441
+
442
+ await app . handle ( req ( '/id/1' ) )
443
+
444
+ expect ( route ) . toBe ( '/id/:id' )
445
+ } )
425
446
} )
You can’t perform that action at this time.
0 commit comments