Skip to content

Commit

Permalink
Merge pull request #210 from devopsfaith/optional_and_mandatory_qs
Browse files Browse the repository at this point in the history
Support mixing optional and mandatory querystring
  • Loading branch information
kpacha authored Mar 6, 2019
2 parents 56f6f4e + c4ee6c8 commit f492762
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion proxy/balancing.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func newLoadBalancedMiddleware(lb sd.Balancer) Middleware {
return nil, err
}
if len(r.Query) > 0 {
r.URL.RawQuery = r.Query.Encode()
r.URL.RawQuery += "&" + r.Query.Encode()
}

return next[0](ctx, &r)
Expand Down
2 changes: 1 addition & 1 deletion proxy/balancing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func testLoadBalancedMw(t *testing.T, lb Middleware) {
t.Errorf("The middleware propagated an unexpected error: %s\n", err.Error())
}

want = "http://127.0.0.1:8080/tupu?some=none"
want = "http://127.0.0.1:8080/tupu?extra=true&some=none"
assertion = func(ctx context.Context, request *Request) (*Response, error) {
if request.URL.String() != want {
t.Errorf("The middleware did not update the request URL! want [%s], have [%s]\n", want, request.URL)
Expand Down

0 comments on commit f492762

Please sign in to comment.