From 6f860cabd1d3bf7d174a91cc21eedacb30dddf57 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 5/8 --- botfilter_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/botfilter_test.go b/botfilter_test.go index 23c01f0c..c4490c4c 100644 --- a/botfilter_test.go +++ b/botfilter_test.go @@ -112,3 +112,13 @@ func Test404ScoreBansOnSubsequentRequest(t *testing.T) { t.Fatalf("New() error = %v", err) } + first := httptest.NewRequest(http.MethodGet, "http://wiki.example/not-found", nil) + first.RemoteAddr = "198.51.100.23:1234" + first.Header.Set("User-Agent", "Mozilla/5.0 Chrome/120.0 AppleWebKit/537.36 Safari/537.36") + first.Header.Set("Accept", "text/html") + firstResponse := httptest.NewRecorder() + handler.ServeHTTP(firstResponse, first) + if firstResponse.Code != http.StatusNotFound { + t.Fatalf("first response status = %d, want 404", firstResponse.Code) + } +