TestContextClientIPWithSingleHeader() — gin Function Reference
Architecture documentation for the TestContextClientIPWithSingleHeader() function in context_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 5c9d551c_5ab1_24d9_77e3_4ebdd694f8df["TestContextClientIPWithSingleHeader()"] ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"] 5c9d551c_5ab1_24d9_77e3_4ebdd694f8df -->|defined in| ebe0ae48_a62b_a38f_5bac_5bbbd96fc508 style 5c9d551c_5ab1_24d9_77e3_4ebdd694f8df fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
context_test.go lines 1180–1192
func TestContextClientIPWithSingleHeader(t *testing.T) {
c, _ := CreateTestContext(httptest.NewRecorder())
c.Request, _ = http.NewRequest(http.MethodGet, "/test", nil)
c.Request.Header.Set("X-Forwarded-For", "1.2.3.4, "+localhostIP)
c.Request.RemoteAddr = localhostIP + ":1234"
c.engine.ForwardedByClientIP = true
c.engine.RemoteIPHeaders = []string{"X-Forwarded-For"}
_ = c.engine.SetTrustedProxies([]string{localhostIP})
// Should return 1.2.3.4
assert.Equal(t, "1.2.3.4", c.ClientIP())
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestContextClientIPWithSingleHeader() do?
TestContextClientIPWithSingleHeader() is a function in the gin codebase, defined in context_test.go.
Where is TestContextClientIPWithSingleHeader() defined?
TestContextClientIPWithSingleHeader() is defined in context_test.go at line 1180.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free