@@ -186,15 +186,19 @@ func TestRouteRedirectTrailingSlash(t *testing.T) {
186
186
assert .Equal (t , 200 , w .Code )
187
187
188
188
w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "../../bug#?" })
189
- assert .Equal (t , "../../../ bug%2523%253F /path" , w .Header ().Get ("Location" ))
189
+ assert .Equal (t , "// bug/ /path" , w .Header ().Get ("Location" ))
190
190
assert .Equal (t , 301 , w .Code )
191
191
192
192
w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "https://gin-gonic.com/#" })
193
- assert .Equal (t , "https%3A /gin-gonic.com/%23/ https%253A /gin-gonic.com/%2523 /path" , w .Header ().Get ("Location" ))
193
+ assert .Equal (t , "https/gin-goniccom/ https/gin-goniccom /path" , w .Header ().Get ("Location" ))
194
194
assert .Equal (t , 301 , w .Code )
195
195
196
196
w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "#bug" })
197
- assert .Equal (t , "%23bug/%2523bug/path" , w .Header ().Get ("Location" ))
197
+ assert .Equal (t , "bug/bug/path" , w .Header ().Get ("Location" ))
198
+ assert .Equal (t , 301 , w .Code )
199
+
200
+ w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "/nor-mal/#?a=1" })
201
+ assert .Equal (t , "/nor-mal/a1/path" , w .Header ().Get ("Location" ))
198
202
assert .Equal (t , 301 , w .Code )
199
203
200
204
router .RedirectTrailingSlash = false
0 commit comments