From 3999e1042c21bba313fba626ee8d2d5f343b5584 Mon Sep 17 00:00:00 2001 From: hoelee Date: Wed, 15 Jul 2026 18:01:00 +0800 Subject: [PATCH] feat(botfilter): botfilter_test.go part 4/8 --- botfilter_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/botfilter_test.go b/botfilter_test.go index bf90d19c..6792584a 100644 --- a/botfilter_test.go +++ b/botfilter_test.go @@ -82,3 +82,16 @@ func TestEncodedScanPathBansBeforeUpstream(t *testing.T) { t.Fatalf("New() error = %v", err) } + request := httptest.NewRequest(http.MethodGet, "http://wiki.example/foo/..%2F.env", nil) + request.RemoteAddr = "198.51.100.22:1234" + request.Header.Set("User-Agent", "Mozilla/5.0 Chrome/120.0 AppleWebKit/537.36 Safari/537.36") + response := httptest.NewRecorder() + handler.ServeHTTP(response, request) + if response.Code != http.StatusForbidden { + t.Fatalf("response status = %d, want %d", response.Code, http.StatusForbidden) + } + if nextCalls != 0 { + t.Fatalf("next handler calls = %d, want 0", nextCalls) + } +} +