Fix query parameter association on GET requests

This commit is contained in:
Dane Everitt 2020-11-01 14:23:03 -08:00
parent fcccda2761
commit b8598e90d4
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -114,9 +114,12 @@ func (r *Request) debug(req *http.Request) {
// second argument it will be passed through on the request as URL parameters.
func (r *Request) Get(url string, data Q) (*Response, error) {
return r.Make(http.MethodGet, r.Endpoint(url), nil, func(r *http.Request) {
q := r.URL.Query()
for k, v := range data {
r.URL.Query().Set(k, v)
q.Set(k, v)
}
r.URL.RawQuery = q.Encode()
})
}