@@ -125,6 +125,35 @@ describe("FastURL", () => {
125125 }
126126 } ) ;
127127
128+ describe ( "absolute URI in request line" , ( ) => {
129+ const cases = [
130+ [ "http://example.com/path" , "/path" ] ,
131+ [ "http://example.com/path?q=1" , "/path" ] ,
132+ [ "file://hehe?/internal/run" , "/" ] ,
133+ [ "file://hehe/abc" , "/abc" ] ,
134+ [ "http://evil.com?/secret" , "/" ] ,
135+ [ "https://host/a/b/c?x=1" , "/a/b/c" ] ,
136+ ] as const ;
137+
138+ for ( const [ input , expected ] of cases ) {
139+ test ( `"${ input } " => pathname "${ expected } "` , ( ) => {
140+ const url = new NodeRequestURL ( {
141+ req : { url : input , headers : { host : "localhost" } } as any ,
142+ } ) ;
143+ expect ( url . pathname ) . toBe ( expected ) ;
144+ } ) ;
145+
146+ test ( `"${ input } " => pathname "${ expected } " (after deopt)` , ( ) => {
147+ const url = new NodeRequestURL ( {
148+ req : { url : input , headers : { host : "localhost" } } as any ,
149+ } ) ;
150+ // Access hostname to trigger _url deopt
151+ void url . hostname ;
152+ expect ( url . pathname ) . toBe ( expected ) ;
153+ } ) ;
154+ }
155+ } ) ;
156+
128157 describe ( "pathname normalization" , ( ) => {
129158 const cases = [
130159 // Literal dot segments
0 commit comments