diff --git a/pkg/muxer/http/mux.go b/pkg/muxer/http/mux.go index 6c57d8db8..fefab67a9 100644 --- a/pkg/muxer/http/mux.go +++ b/pkg/muxer/http/mux.go @@ -237,7 +237,7 @@ func headersRegexp(route *mux.Route, headers ...string) error { func query(route *mux.Route, query ...string) error { var queries []string for _, elem := range query { - queries = append(queries, strings.Split(elem, "=")...) + queries = append(queries, strings.SplitN(elem, "=", 2)...) } route.Queries(queries...) diff --git a/pkg/muxer/http/mux_test.go b/pkg/muxer/http/mux_test.go index 2f2d64c9a..cacc639b2 100644 --- a/pkg/muxer/http/mux_test.go +++ b/pkg/muxer/http/mux_test.go @@ -252,6 +252,14 @@ func Test_addRoute(t *testing.T) { "http://localhost/foo?bar=baz": http.StatusNotFound, }, }, + { + desc: "Query with multiple equals", + rule: "Query(`foo=b=ar`)", + expected: map[string]int{ + "http://localhost/foo?foo=b=ar": http.StatusOK, + "http://localhost/foo?foo=bar": http.StatusNotFound, + }, + }, { desc: "Rule with simple path", rule: `Path("/a")`,