Skip to content

Commit

Permalink
Merge pull request #13 from krakend/owasp_fixes
Browse files Browse the repository at this point in the history
use https in test files to avoid warning
  • Loading branch information
kpacha authored Sep 18, 2024
2 parents 074846c + b72a15f commit 42274f4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion detector_bechmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++ {
Expand Down
6 changes: 3 additions & 3 deletions detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions gin/detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 42274f4

Please sign in to comment.