all repos — telegram-bot-api @ 7f0dd9c504756f558df1a3d8930d0745497a3912

Golang bindings for the Telegram Bot API

little fix that sometimes causes crash
Lorenzo Landolfi lorenzo.landolfi97@gmail.com
Mon, 06 Jul 2015 21:25:18 +0200
commit

7f0dd9c504756f558df1a3d8930d0745497a3912

parent

44e25815ef3a711ba3b3feffacdc5196954b12c4

1 files changed, 2 insertions(+), 1 deletions(-)

jump to
M methods.gomethods.go

@@ -132,9 +132,10 @@ // MakeRequest makes a request to a specific endpoint with our token.

// All requests are POSTs because Telegram doesn't care, and it's easier. func (bot *BotAPI) MakeRequest(endpoint string, params url.Values) (APIResponse, error) { resp, err := http.PostForm("https://api.telegram.org/bot"+bot.Token+"/"+endpoint, params) - defer resp.Body.Close() if err != nil { return APIResponse{}, err + } else { + defer resp.Body.Close() } bytes, err := ioutil.ReadAll(resp.Body)