TestContextShouldBindHeader() — gin Function Reference
Architecture documentation for the TestContextShouldBindHeader() function in context_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD e3b79577_7358_ef59_7d5f_a04b4717c6c5["TestContextShouldBindHeader()"] ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"] e3b79577_7358_ef59_7d5f_a04b4717c6c5 -->|defined in| ebe0ae48_a62b_a38f_5bac_5bbbd96fc508 style e3b79577_7358_ef59_7d5f_a04b4717c6c5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
context_test.go lines 2385–2405
func TestContextShouldBindHeader(t *testing.T) {
w := httptest.NewRecorder()
c, _ := CreateTestContext(w)
c.Request, _ = http.NewRequest(http.MethodPost, "/", nil)
c.Request.Header.Add("rate", "8000")
c.Request.Header.Add("domain", "music")
c.Request.Header.Add("limit", "1000")
var testHeader struct {
Rate int `header:"Rate"`
Domain string `header:"Domain"`
Limit int `header:"limit"`
}
require.NoError(t, c.ShouldBindHeader(&testHeader))
assert.Equal(t, 8000, testHeader.Rate)
assert.Equal(t, "music", testHeader.Domain)
assert.Equal(t, 1000, testHeader.Limit)
assert.Equal(t, 0, w.Body.Len())
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestContextShouldBindHeader() do?
TestContextShouldBindHeader() is a function in the gin codebase, defined in context_test.go.
Where is TestContextShouldBindHeader() defined?
TestContextShouldBindHeader() is defined in context_test.go at line 2385.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free