fix accept 200-299 status codes
This commit is contained in:
parent
bd4c338eb4
commit
f5c1694211
1 changed files with 2 additions and 1 deletions
3
api.go
3
api.go
|
|
@ -57,7 +57,8 @@ func (s *Scraper) RequestAPI(req *http.Request, target interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
statusOK := resp.StatusCode >= 200 && resp.StatusCode < 300
|
||||||
|
if !statusOK {
|
||||||
return fmt.Errorf("response status %s: %s", resp.Status, content)
|
return fmt.Errorf("response status %s: %s", resp.Status, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue