Add check for status code on request, closes #60
Syfaro syfaro@foxpaw.in
Fri, 27 Jan 2017 11:35:23 -0600
1 files changed,
4 insertions(+),
0 deletions(-)
jump to
M
bot.go
→
bot.go
@@ -68,6 +68,10 @@ if resp.StatusCode == http.StatusForbidden {
return APIResponse{}, errors.New(ErrAPIForbidden) } + if resp.StatusCode != http.StatusOK { + return APIResponse{}, errors.New(http.StatusText(resp.StatusCode)) + } + bytes, err := ioutil.ReadAll(resp.Body) if err != nil { return APIResponse{}, err