go test -run Test_Ctx_Hostname_UntrustedProxyRange
(t *testing.T)
| 3175 | |
| 3176 | // go test -run Test_Ctx_Hostname_UntrustedProxyRange |
| 3177 | func Test_Ctx_Hostname_UntrustedProxyRange(t *testing.T) { |
| 3178 | t.Parallel() |
| 3179 | |
| 3180 | app := New(Config{ |
| 3181 | TrustProxy: true, |
| 3182 | TrustProxyConfig: TrustProxyConfig{Proxies: []string{"1.0.0.0/30"}}, |
| 3183 | }) |
| 3184 | c := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 3185 | c.Request().SetRequestURI("http://google.com/test") |
| 3186 | c.Request().Header.Set(HeaderXForwardedHost, "google1.com") |
| 3187 | require.Equal(t, "google.com", c.Hostname()) |
| 3188 | app.ReleaseCtx(c) |
| 3189 | } |
| 3190 | |
| 3191 | // go test -run Test_Ctx_Port |
| 3192 | func Test_Ctx_Port(t *testing.T) { |
nothing calls this directly
no test coverage detected