feat(botfilter): botfilter_test.go part 4/8

This commit is contained in:
hoelee committed 2026-07-15 18:01:00 +08:00
1 parent d8ab36da4a
commit 3999e1042c
1 file changed
+13
+13
View File
@@ -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)
}
}