From b72a15f8810efe4951e39668d0741518bb1fbc75 Mon Sep 17 00:00:00 2001 From: David Hontecillas Date: Wed, 18 Sep 2024 17:42:45 +0200 Subject: [PATCH] use https in test files to avoid warning --- detector_bechmark_test.go | 2 +- detector_test.go | 6 +++--- gin/detector_test.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/detector_bechmark_test.go b/detector_bechmark_test.go index 2bc5ace..97f8697 100644 --- a/detector_bechmark_test.go +++ b/detector_bechmark_test.go @@ -55,7 +55,7 @@ func becnhDetection(b *testing.B, f DetectorFunc) { {"ko_4", "Pingdom.com_bot_version_1.2"}, } { - req, _ := http.NewRequest("GET", "http://example.com", nil) + req, _ := http.NewRequest("GET", "https://example.com", http.NoBody) req.Header.Add("User-Agent", tc.ua) b.Run(tc.name, func(b *testing.B) { for i := 0; i < b.N; i++ { diff --git a/detector_test.go b/detector_test.go index c50a5d4..ebf8f88 100644 --- a/detector_test.go +++ b/detector_test.go @@ -21,7 +21,7 @@ func TestNew_rejectEmptyHeader(t *testing.T) { return } - req, _ := http.NewRequest("GET", "http://example.com", http.NoBody) // skipcq: GO-S1028 + req, _ := http.NewRequest("GET", "https://example.com", http.NoBody) // skipcq: GO-S1028 req.Header.Add("User-Agent", "") if !d(req) { t.Error("req with empty User-Agent has not been detected as a bot") @@ -74,7 +74,7 @@ func testDetection(f DetectorFunc) error { "c", "Pingdom.com_bot_version_1.1", } { - req, _ := http.NewRequest("GET", "http://example.com", http.NoBody) // skipcq: GO-S1028 + req, _ := http.NewRequest("GET", "https://example.com", http.NoBody) req.Header.Add("User-Agent", ua) if f(req) { return fmt.Errorf("the req #%d has been detected as a bot: %s", i, ua) @@ -87,7 +87,7 @@ func testDetection(f DetectorFunc) error { "facebookexternalhit/1.1", "Pingdom.com_bot_version_1.2", } { - req, _ := http.NewRequest("GET", "http://example.com", http.NoBody) + req, _ := http.NewRequest("GET", "https://example.com", http.NoBody) req.Header.Add("User-Agent", ua) if !f(req) { return fmt.Errorf("the req #%d has not been detected as a bot: %s", i, ua) diff --git a/gin/detector_test.go b/gin/detector_test.go index 7303c7e..52ff5a4 100644 --- a/gin/detector_test.go +++ b/gin/detector_test.go @@ -80,7 +80,7 @@ func testDetection(engine *gin.Engine) error { "c", "Pingdom.com_bot_version_1.1", } { - req, _ := http.NewRequest("GET", "http://example.com/", nil) + req, _ := http.NewRequest("GET", "https://example.com/", nil) req.Header.Add("User-Agent", ua) w := httptest.NewRecorder() @@ -97,7 +97,7 @@ func testDetection(engine *gin.Engine) error { "facebookexternalhit/1.1", "Pingdom.com_bot_version_1.2", } { - req, _ := http.NewRequest("GET", "http://example.com/", nil) + req, _ := http.NewRequest("GET", "https://example.com/", nil) req.Header.Add("User-Agent", ua) w := httptest.NewRecorder()