From a7e0c19d35cf405ccd29e7ffeade3d4d4f7b30f1 Mon Sep 17 00:00:00 2001 From: 178inaba <178inaba@users.noreply.github.com> Date: Tue, 18 Apr 2017 01:59:52 +0900 Subject: [PATCH] Fix get query to request url --- mastodon.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mastodon.go b/mastodon.go index 399eac4..a14c7c8 100644 --- a/mastodon.go +++ b/mastodon.go @@ -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 }