diff options
| author | demo <demo@antix1> | 2026-05-10 11:16:20 -0400 |
|---|---|---|
| committer | demo <demo@antix1> | 2026-05-10 11:16:20 -0400 |
| commit | 5b80104c836a97e09348dc1bca963daa7f36ae4f (patch) | |
| tree | 072198fc398ca15f8e4252ce00cf3dec3af3f394 /internal/links/fetch.go | |
| parent | 6ba67c878cefe8123e3fcd81f5dd181920a22c08 (diff) | |
fix: check status code of response
Diffstat (limited to 'internal/links/fetch.go')
| -rw-r--r-- | internal/links/fetch.go | 4 |
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 } |
