Skip to content

Commit dc91781

Browse files
committed
Works with POST
1 parent 427a76d commit dc91781

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

api/client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ func (c Client) GraphQL(query string, variables map[string]interface{}, data int
100100
}
101101

102102
// REST performs a REST request and parses the response.
103-
func (c Client) REST(method string, p string, data interface{}) error {
103+
func (c Client) REST(method string, p string, body io.Reader, data interface{}) error {
104104
url := path.Join("https://api.github.com/", p)
105-
req, err := http.NewRequest(method, url, nil)
105+
req, err := http.NewRequest(method, url, body)
106106
if err != nil {
107107
return err
108108
}
@@ -119,12 +119,12 @@ func (c Client) REST(method string, p string, data interface{}) error {
119119
return handleHTTPError(resp)
120120
}
121121

122-
body, err := ioutil.ReadAll(resp.Body)
122+
b, err := ioutil.ReadAll(resp.Body)
123123
if err != nil {
124124
return err
125125
}
126126

127-
err = json.Unmarshal(body, &data)
127+
err = json.Unmarshal(b, &data)
128128
if err != nil {
129129
return err
130130
}

update/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ func UpdateMessage(client *api.Client) *string {
3838
func getLatestRelease(client *api.Client) (*releaseInfo, error) {
3939
path := fmt.Sprintf("repos/%s/releases/latest", nwo)
4040
var r releaseInfo
41-
err := client.REST("GET", path, &r)
41+
err := client.REST("GET", path, nil, &r)
4242
return &r, err
4343
}

0 commit comments

Comments
 (0)