mirror of
https://github.com/tenox7/wrp.git
synced 2025-02-07 08:30:25 +00:00
process http status code
This commit is contained in:
parent
1d9af26604
commit
701240eb7c
3
txt.go
3
txt.go
@ -94,6 +94,9 @@ func grabImage(id, url string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error downloading %q: %v", url, err)
|
||||
}
|
||||
if r.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("%q status code: %v", url, r.StatusCode)
|
||||
}
|
||||
defer r.Body.Close()
|
||||
img, err = io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user