all repos — telegram-bot-api @ 5d28cf05d07dfba60252d55fdaff5b31f0552895

Golang bindings for the Telegram Bot API

Fix returning APIResponse from SetWebHook
Sergey Juriev sjuriev@gmail.com
Wed, 18 Jan 2017 12:05:01 +0300
commit

5d28cf05d07dfba60252d55fdaff5b31f0552895

parent

99170e2de436c1be90d2ef23dcf533b55a973e56

1 files changed, 6 insertions(+), 9 deletions(-)

jump to
M bot.gobot.go

@@ -184,7 +184,11 @@ log.Println(string(bytes))

} var apiResp APIResponse - json.Unmarshal(bytes, &apiResp) + + err = json.Unmarshal(bytes, &apiResp) + if err != nil { + return APIResponse{}, err + } if !apiResp.Ok { return APIResponse{}, errors.New(apiResp.Description)

@@ -431,14 +435,7 @@ if err != nil {

return APIResponse{}, err } - var apiResp APIResponse - json.Unmarshal(resp.Result, &apiResp) - - if bot.Debug { - log.Printf("setWebhook resp: %+v\n", apiResp) - } - - return apiResp, nil + return resp, nil } // GetWebhookInfo allows you to fetch information about a webhook and if