summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordemo <demo@antix1>2026-05-10 11:16:20 -0400
committerdemo <demo@antix1>2026-05-10 11:16:20 -0400
commit5b80104c836a97e09348dc1bca963daa7f36ae4f (patch)
tree072198fc398ca15f8e4252ce00cf3dec3af3f394
parent6ba67c878cefe8123e3fcd81f5dd181920a22c08 (diff)
fix: check status code of response
-rw-r--r--internal/links/fetch.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/links/fetch.go b/internal/links/fetch.go
index 864d754..53cc692 100644
--- a/internal/links/fetch.go
+++ b/internal/links/fetch.go
@@ -24,5 +24,9 @@ func fetch(rawURL string, timeoutSecs int) (io.Reader, error) {
}
defer resp.Body.Close()
+ if resp.StatusCode != http.StatusOK {
+ return nil, fmt.Errorf("status for %s for %s: %s", http.MethodGet, rawURL, resp.Status)
+ }
+
return bufio.NewReader(resp.Body), nil
}