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) + } +