feat(botfilter): botfilter_test.go part 7/8
This commit is contained in:
1 parent
c3192aa8f5
commit
b14575145f
1 file changed
+10
@@ -150,3 +150,13 @@ func TestTrustedProxyHeaderSeparatesClients(t *testing.T) {
|
||||
t.Fatalf("New() error = %v", err)
|
||||
}
|
||||
|
||||
bad := httptest.NewRequest(http.MethodGet, "http://wiki.example/", nil)
|
||||
bad.RemoteAddr = "127.0.0.1:1234"
|
||||
bad.Header.Set("X-Forwarded-For", "198.51.100.61")
|
||||
bad.Header.Del("User-Agent")
|
||||
badResponse := httptest.NewRecorder()
|
||||
handler.ServeHTTP(badResponse, bad)
|
||||
if badResponse.Code != http.StatusForbidden {
|
||||
t.Fatalf("bad client status = %d, want 403", badResponse.Code)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user