Skip to content

Commit 0d2feed

Browse files
author
Syfaro
committed
fix UploadFile not properly throwing an error when not Ok response
1 parent e1a0a81 commit 0d2feed

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

methods.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldna
290290
var apiResp APIResponse
291291
json.Unmarshal(bytes, &apiResp)
292292

293+
if !apiResp.Ok {
294+
return APIResponse{}, errors.New(apiResp.Description)
295+
}
296+
293297
return apiResp, nil
294298
}
295299

0 commit comments

Comments
 (0)