Closed bbrodriges closed 7 years ago
Hi @bbrodriges , late for reply, can you show me the router codes so I can reproduce this issue?
TestPathClean fails when I add these new unit tests:
// Params
{"abc/?foo=bar", "/abc/?foo=bar"},
{"abc?foo=bar", "/abc?foo=bar"},
{"abc//?foo=bar", "/abc/?foo=bar"},
{"abc//./?foo=bar", "/abc/?foo=bar"},
{"/abc/.?foo", "/abc/?foo"},
If you look in path_test.go there's a test {"/abc/.", "/abc/"}
which passes, but when I add params where the URI ends with a period, the Clean function doesn't strip the dot and keep the params. Thoughts? Maybe my test cases are incorrect if the params are being stripped off somewhere else before CleanPath would ever be called, but I don't see a unit test anywhere for parameter handling.
why this still not merged?
Logger.Debugln(string(ctx.QueryArgs().QueryString()))
"/recommend?itemid=20170914141825212&alg=1" -> "itemid=20170914141825212&alg=1" "/recommend/?itemid=20170914141825212&alg=1" -> ""
Merged. Busy with work these days.
This commit fixes query string lost on trailing slash redirect.
Example: handler -
router.POST("/v1/info/", myHandler)
request -mysite.com/v1/info?id=1
expected -HTTP 301 /v1/info/?id=1
got -HTTP 301 /v1/info/