go test -run Test_Ctx_Host_TrustedProxyRange
(t *testing.T)
| 2937 | |
| 2938 | // go test -run Test_Ctx_Host_TrustedProxyRange |
| 2939 | func Test_Ctx_Host_TrustedProxyRange(t *testing.T) { |
| 2940 | t.Parallel() |
| 2941 | |
| 2942 | app := New(Config{TrustProxy: true, TrustProxyConfig: TrustProxyConfig{Proxies: []string{"0.0.0.0/30"}}}) |
| 2943 | c := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 2944 | c.Request().SetRequestURI("http://google.com/test") |
| 2945 | c.Request().Header.Set(HeaderXForwardedHost, "google1.com") |
| 2946 | require.Equal(t, "google1.com", c.Host()) |
| 2947 | app.ReleaseCtx(c) |
| 2948 | } |
| 2949 | |
| 2950 | // go test -run Test_Ctx_Host_UntrustedProxyRange |
| 2951 | func Test_Ctx_Host_UntrustedProxyRange(t *testing.T) { |
nothing calls this directly
no test coverage detected