fix UploadFile not properly throwing an error when not Ok response

pull/33/head
Syfaro 10 years ago
parent e1a0a819c0
commit 0d2feed6c2
  1. 4
      methods.go

@ -290,6 +290,10 @@ func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldna
var apiResp APIResponse
json.Unmarshal(bytes, &apiResp)
if !apiResp.Ok {
return APIResponse{}, errors.New(apiResp.Description)
}
return apiResp, nil
}