fixed path issue with url parameters

This commit is contained in:
Martin Riedl 2019-08-22 11:23:25 +02:00
parent 9a1490784e
commit 9bf43315b3
Signed by: martinr92
GPG key ID: FB68DA65516A804C
2 changed files with 2 additions and 2 deletions

View file

@ -113,7 +113,7 @@ func (router *Router) validateRoute(path string) error {
func (router *Router) ServeHTTP(response http.ResponseWriter, request *http.Request) {
// check for exact matching
route, _, parameter := router.findRoute(request.Method, request.RequestURI, false)
route, _, parameter := router.findRoute(request.Method, request.URL.Path, false)
if route != nil && route.handler != nil {
route.handler.ServeHTTP(response, request, RoutingInfo{Parameters: parameter})
return

View file

@ -90,7 +90,7 @@ func TestRouterServerHandler(t *testing.T) {
go http.Serve(listener, router)
// call method
_, err = http.Get("http://localhost:8081/")
_, err = http.Get("http://localhost:8081/?test=false")
if err != nil {
t.Error(err)
}