summaryrefslogtreecommitdiff
path: root/internal/links/fetch.go
diff options
context:
space:
mode:
authordemo <demo@antix1>2026-05-10 21:56:24 -0400
committerdemo <demo@antix1>2026-05-10 21:56:24 -0400
commit916e778dfccc2aa5ce95056b97e11f134bc941f7 (patch)
treee3e7036a4a727f3231d395cc74be917cac0f5b8c /internal/links/fetch.go
parent79577b9024dea082c9cc8380997a224e3934df27 (diff)
refactor: move 'fetch' to its own package
Diffstat (limited to 'internal/links/fetch.go')
-rw-r--r--internal/links/fetch.go32
1 files changed, 0 insertions, 32 deletions
diff --git a/internal/links/fetch.go b/internal/links/fetch.go
deleted file mode 100644
index 53cc692..0000000
--- a/internal/links/fetch.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package links
-
-import (
- "bufio"
- "fmt"
- "io"
- "net/http"
- "time"
-)
-
-func fetch(rawURL string, timeoutSecs int) (io.Reader, error) {
- client := http.Client{
- Timeout: time.Duration(timeoutSecs) * time.Second,
- }
-
- req, err := http.NewRequest(http.MethodGet, rawURL, nil)
- if err != nil {
- return nil, fmt.Errorf("can't create %s request for %s", http.MethodGet, rawURL)
- }
-
- resp, err := client.Do(req)
- if err != nil {
- return nil, fmt.Errorf("client failed to perform %s request for %s", http.MethodGet, rawURL)
- }
- 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
-}