little fix that sometimes causes crash

bot-api-6.1
Lorenzo Landolfi 2015-07-06 21:25:18 +02:00
parent 44e25815ef
commit 7f0dd9c504
1 changed files with 2 additions and 1 deletions

View File

@ -132,9 +132,10 @@ type WebhookConfig struct {
// 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)