From f5c1694211a07e58275d26a4bb2b8c8ee8efef6d Mon Sep 17 00:00:00 2001 From: Valentine Date: Sat, 9 Mar 2024 03:54:20 +0300 Subject: [PATCH] fix accept 200-299 status codes --- api.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api.go b/api.go index bd1e3ef..fb6dfcf 100644 --- a/api.go +++ b/api.go @@ -57,7 +57,8 @@ func (s *Scraper) RequestAPI(req *http.Request, target interface{}) error { 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) }