You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following test will be failed, no matter UseEncodedPath() is used or not.
func TestQuery(t *testing.T) {
url := "http://localhost/test?q=%0A"
hit := false
m := mux.NewRouter()
m.Path("/test").Queries("q", "{q}").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
hit = true
})
req, _ := http.NewRequest("GET", url, nil)
m.ServeHTTP(&httptest.ResponseRecorder{}, req)
if !hit {
t.Errorf("query did not hit")
}
}
It looks like the defaultPattern in newRouteRegexp did not include the newline char.
I tried changing the value from ".*" to "(?s).*", then the test passes.
But I do not sure the fix is appropriate.
The text was updated successfully, but these errors were encountered:
The following test will be failed, no matter UseEncodedPath() is used or not.
It looks like the defaultPattern in newRouteRegexp did not include the newline char.
I tried changing the value from
".*"
to"(?s).*"
, then the test passes.But I do not sure the fix is appropriate.
The text was updated successfully, but these errors were encountered: