From a60d58d322bad0d106d7162b3b11b2cb72d18409 Mon Sep 17 00:00:00 2001 From: hoelee Date: Mon, 6 Jul 2026 11:46:00 +0800 Subject: [PATCH] feat(botfilter): add TestEncodedScanPathBansBeforeUpstream --- botfilter_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/botfilter_test.go b/botfilter_test.go index 7df67066..bf90d19c 100644 --- a/botfilter_test.go +++ b/botfilter_test.go @@ -69,3 +69,16 @@ func TestWhitelistBypassesFilter(t *testing.T) { } } +func TestEncodedScanPathBansBeforeUpstream(t *testing.T) { + cfg := CreateConfig() + cfg.RequireUserAgent = false + cfg.RequireAccept = false + nextCalls := 0 + handler, err := New(context.Background(), http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { + nextCalls++ + rw.WriteHeader(http.StatusOK) + }), cfg, "test") + if err != nil { + t.Fatalf("New() error = %v", err) + } +