go test -run Test_Ctx_Host_UntrustedProxyRange
(t *testing.T)
| 2949 | |
| 2950 | // go test -run Test_Ctx_Host_UntrustedProxyRange |
| 2951 | func Test_Ctx_Host_UntrustedProxyRange(t *testing.T) { |
| 2952 | t.Parallel() |
| 2953 | |
| 2954 | app := New(Config{TrustProxy: true, TrustProxyConfig: TrustProxyConfig{Proxies: []string{"1.0.0.0/30"}}}) |
| 2955 | c := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 2956 | c.Request().SetRequestURI("http://google.com/test") |
| 2957 | c.Request().Header.Set(HeaderXForwardedHost, "google1.com") |
| 2958 | require.Equal(t, "google.com", c.Host()) |
| 2959 | app.ReleaseCtx(c) |
| 2960 | } |
| 2961 | |
| 2962 | // go test -v -run=^$ -bench=Benchmark_Ctx_Host -benchmem -count=4 |
| 2963 | func Benchmark_Ctx_Host(b *testing.B) { |
nothing calls this directly
no test coverage detected