Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Commit 25c336e

Browse files
committed
fixup! convert body to query string in case of a GET request
1 parent 38880e3 commit 25c336e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

gitea/gitea.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ func (c *Client) doRequest(method, path string, header http.Header, body interfa
7171
u.RawPath = "/api/v1" + path
7272
u.Path = "/api/v1" + unescaped
7373

74-
if body != nil {
75-
q, err := query.Values(body)
76-
if err != nil {
77-
return nil, err
74+
if method == "GET" {
75+
if body != nil {
76+
q, err := query.Values(body)
77+
if err != nil {
78+
return nil, err
79+
}
80+
u.RawQuery = q.Encode()
7881
}
79-
u.RawQuery = q.Encode()
8082
}
8183

8284
req := &http.Request{

0 commit comments

Comments
 (0)