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

This commit is contained in:
hoelee committed 2026-07-10 18:01:00 +08:00
1 parent 7877cc7ebd
commit 1b22e8e907
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)
}