Fix query parameter association on GET requests
This commit is contained in:
parent
fcccda2761
commit
b8598e90d4
|
@ -114,9 +114,12 @@ func (r *Request) debug(req *http.Request) {
|
||||||
// second argument it will be passed through on the request as URL parameters.
|
// second argument it will be passed through on the request as URL parameters.
|
||||||
func (r *Request) Get(url string, data Q) (*Response, error) {
|
func (r *Request) Get(url string, data Q) (*Response, error) {
|
||||||
return r.Make(http.MethodGet, r.Endpoint(url), nil, func(r *http.Request) {
|
return r.Make(http.MethodGet, r.Endpoint(url), nil, func(r *http.Request) {
|
||||||
|
q := r.URL.Query()
|
||||||
for k, v := range data {
|
for k, v := range data {
|
||||||
r.URL.Query().Set(k, v)
|
q.Set(k, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r.URL.RawQuery = q.Encode()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user