go test -run Test_Ctx_IP_TrustedProxy
(t *testing.T)
| 3385 | |
| 3386 | // go test -run Test_Ctx_IP_TrustedProxy |
| 3387 | func Test_Ctx_IP_TrustedProxy(t *testing.T) { |
| 3388 | t.Parallel() |
| 3389 | app := New(Config{ |
| 3390 | TrustProxy: true, |
| 3391 | TrustProxyConfig: TrustProxyConfig{Proxies: []string{"0.0.0.0"}}, |
| 3392 | ProxyHeader: HeaderXForwardedFor, |
| 3393 | }) |
| 3394 | c := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 3395 | c.Request().Header.Set(HeaderXForwardedFor, "0.0.0.1") |
| 3396 | require.Equal(t, "0.0.0.1", c.IP()) |
| 3397 | } |
| 3398 | |
| 3399 | // go test -run Test_Ctx_IP_StripTrustedProxies |
| 3400 | func Test_Ctx_IP_StripTrustedProxies(t *testing.T) { |
nothing calls this directly
no test coverage detected