Fix get query to request url

This commit is contained in:
178inaba 2017-04-18 01:59:52 +09:00
parent 552016b3be
commit a7e0c19d35

View File

@ -39,7 +39,13 @@ func (c *Client) doAPI(ctx context.Context, method string, uri string, params in
var req *http.Request
ct := "application/x-www-form-urlencoded"
if values, ok := params.(url.Values); ok {
req, err = http.NewRequest(method, u.String(), strings.NewReader(values.Encode()))
var body io.Reader
if method == http.MethodGet {
u.RawQuery = values.Encode()
} else {
body = strings.NewReader(values.Encode())
}
req, err = http.NewRequest(method, u.String(), body)
if err != nil {
return err
}