@@ -119,7 +119,7 @@ describe("getUrlParts", () => {
119119 it ( "returns url parts for /" , ( ) => {
120120 expect ( getUrlParts ( "/" , false ) ) . toEqual ( {
121121 hostname : "" ,
122- pathname : "" , // TODO: This behaviour is inconsistent with external pathname
122+ pathname : "/" ,
123123 protocol : "" ,
124124 queryString : "" ,
125125 } ) ;
@@ -128,16 +128,16 @@ describe("getUrlParts", () => {
128128 it ( "returns url parts" , ( ) => {
129129 expect ( getUrlParts ( "/relative" , false ) ) . toEqual ( {
130130 hostname : "" ,
131- pathname : "relative" ,
132- protocol : "" , // TODO: This behaviour is inconsistent with external pathname
131+ pathname : "/ relative" ,
132+ protocol : "" ,
133133 queryString : "" ,
134134 } ) ;
135135 } ) ;
136136
137137 it ( "returns url parts with query string" , ( ) => {
138138 expect ( getUrlParts ( "/relative/path?query=1" , false ) ) . toEqual ( {
139139 hostname : "" ,
140- pathname : "relative/path" , // TODO: This behaviour is inconsistent with external pathname
140+ pathname : "/ relative/path" ,
141141 protocol : "" ,
142142 queryString : "query=1" ,
143143 } ) ;
@@ -162,6 +162,16 @@ describe("getUrlParts", () => {
162162 } ) ;
163163 } ) ;
164164
165+ // For reference https://github.com/opennextjs/opennextjs-aws/issues/591
166+ it ( "returns url parts for / without trailing slash" , ( ) => {
167+ expect ( getUrlParts ( "http://localhost" , true ) ) . toEqual ( {
168+ hostname : "localhost" ,
169+ pathname : "" ,
170+ protocol : "http:" ,
171+ queryString : "" ,
172+ } ) ;
173+ } ) ;
174+
165175 it ( "returns url parts" , ( ) => {
166176 expect ( getUrlParts ( "https://localhost/relative" , true ) ) . toEqual ( {
167177 hostname : "localhost" ,
0 commit comments