fix UploadFile not properly throwing an error when not Ok response
parent
e1a0a819c0
commit
0d2feed6c2
|
@ -290,6 +290,10 @@ func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldna
|
||||||
var apiResp APIResponse
|
var apiResp APIResponse
|
||||||
json.Unmarshal(bytes, &apiResp)
|
json.Unmarshal(bytes, &apiResp)
|
||||||
|
|
||||||
|
if !apiResp.Ok {
|
||||||
|
return APIResponse{}, errors.New(apiResp.Description)
|
||||||
|
}
|
||||||
|
|
||||||
return apiResp, nil
|
return apiResp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue