From 0e3e6c54de9bb2e03351b98ab69812ac8610d5cb Mon Sep 17 00:00:00 2001 From: bel Date: Mon, 5 May 2025 21:32:26 -0600 Subject: [PATCH] fix tests vs running --- src/cmd/cron/main_test.go | 5 +++-- src/feeds/http.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmd/cron/main_test.go b/src/cmd/cron/main_test.go index 7d73557..b920057 100644 --- a/src/cmd/cron/main_test.go +++ b/src/cmd/cron/main_test.go @@ -29,9 +29,9 @@ func TestOne(t *testing.T) { }, "feeds": func(t *testing.T) context.Context { gets := []string{} - sURL := "http://localhost:10000/" + sURL := "http://localhost:10001/" s := &http.Server{ - Addr: ":10000", + Addr: ":10001", Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { gets = append(gets, r.URL.String()) rb, _ := io.ReadAll(r.Body) @@ -43,6 +43,7 @@ func TestOne(t *testing.T) { case "10": case "11": default: + t.Logf("%s => 404", r.URL) http.NotFound(w, r) } diff --git a/src/feeds/http.go b/src/feeds/http.go index cd2d7e3..b2c5b59 100644 --- a/src/feeds/http.go +++ b/src/feeds/http.go @@ -132,7 +132,7 @@ func proxyFetch(ctx context.Context, u string) (string, error) { b, _ := io.ReadAll(resp.Body) if resp.StatusCode != http.StatusOK { - return "", fmt.Errorf("failed fetch: (%d) %s", resp.StatusCode, b) + return "", fmt.Errorf("failed fetch %s %s: (%d) %s", req.Method, req.URL.String(), resp.StatusCode, b) } return string(b), nil