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

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