From e16bcc1780c46dfef555075a75e67bac1fcb79f8 Mon Sep 17 00:00:00 2001 From: Ron Rise Date: Wed, 21 Jan 2026 21:48:00 -0500 Subject: [PATCH] Simplify httpGet function in client_test.go for cleaner code --- reddit/client_test.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/reddit/client_test.go b/reddit/client_test.go index 9759a91..7f747ce 100644 --- a/reddit/client_test.go +++ b/reddit/client_test.go @@ -1,7 +1,6 @@ package reddit import ( - "fmt" "net/http" "net/http/httptest" "strings" @@ -50,11 +49,8 @@ func TestGetLatestImage(t *testing.T) { defer server.Close() // Custom httpGet function for testing - httpGet := func(url string) (*http.Response, error) { - if strings.Contains(url, "/r/wallpaper/.json") { - return http.Get(server.URL + "/r/wallpaper/.json") - } - return nil, fmt.Errorf("unexpected URL: %s", url) + httpGet := func() (*http.Response, error) { + return http.Get(server.URL + "/r/wallpaper/.json") } // Test the function