all repos — telegram-bot-api @ 3866c68e795c67225c59663bd0e84291512965f6

Golang bindings for the Telegram Bot API

Add check for status code on request, closes #60
Syfaro syfaro@foxpaw.in
Fri, 27 Jan 2017 11:35:23 -0600
commit

3866c68e795c67225c59663bd0e84291512965f6

parent

3293f3ad8411de32d99e443cd82aec7c3bb01a5a

1 files changed, 4 insertions(+), 0 deletions(-)

jump to
M bot.gobot.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