Merge branch 'master' of github.com:mattn/go-mastodon

This commit is contained in:
Yasuhiro Matsumoto 2017-04-18 17:18:17 +09:00
commit 20174d5b4a
7 changed files with 485 additions and 93 deletions

View file

@ -66,7 +66,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
}