@@ -119,7 +119,7 @@ describe("getUrlParts", () => {
119
119
it ( "returns url parts for /" , ( ) => {
120
120
expect ( getUrlParts ( "/" , false ) ) . toEqual ( {
121
121
hostname : "" ,
122
- pathname : "" , // TODO: This behaviour is inconsistent with external pathname
122
+ pathname : "/" ,
123
123
protocol : "" ,
124
124
queryString : "" ,
125
125
} ) ;
@@ -128,16 +128,16 @@ describe("getUrlParts", () => {
128
128
it ( "returns url parts" , ( ) => {
129
129
expect ( getUrlParts ( "/relative" , false ) ) . toEqual ( {
130
130
hostname : "" ,
131
- pathname : "relative" ,
132
- protocol : "" , // TODO: This behaviour is inconsistent with external pathname
131
+ pathname : "/ relative" ,
132
+ protocol : "" ,
133
133
queryString : "" ,
134
134
} ) ;
135
135
} ) ;
136
136
137
137
it ( "returns url parts with query string" , ( ) => {
138
138
expect ( getUrlParts ( "/relative/path?query=1" , false ) ) . toEqual ( {
139
139
hostname : "" ,
140
- pathname : "relative/path" , // TODO: This behaviour is inconsistent with external pathname
140
+ pathname : "/ relative/path" ,
141
141
protocol : "" ,
142
142
queryString : "query=1" ,
143
143
} ) ;
@@ -162,6 +162,16 @@ describe("getUrlParts", () => {
162
162
} ) ;
163
163
} ) ;
164
164
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
+
165
175
it ( "returns url parts" , ( ) => {
166
176
expect ( getUrlParts ( "https://localhost/relative" , true ) ) . toEqual ( {
167
177
hostname : "localhost" ,
0 commit comments