Home / Function/ TestContextHeaders() — gin Function Reference

TestContextHeaders() — gin Function Reference

Architecture documentation for the TestContextHeaders() function in context_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  05c1daf5_f44d_e53c_f047_92b90917fba4["TestContextHeaders()"]
  ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"]
  05c1daf5_f44d_e53c_f047_92b90917fba4 -->|defined in| ebe0ae48_a62b_a38f_5bac_5bbbd96fc508
  style 05c1daf5_f44d_e53c_f047_92b90917fba4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

context_test.go lines 1535–1549

func TestContextHeaders(t *testing.T) {
	c, _ := CreateTestContext(httptest.NewRecorder())
	c.Header("Content-Type", "text/plain")
	c.Header("X-Custom", "value")

	assert.Equal(t, "text/plain", c.Writer.Header().Get("Content-Type"))
	assert.Equal(t, "value", c.Writer.Header().Get("X-Custom"))

	c.Header("Content-Type", "text/html")
	c.Header("X-Custom", "")

	assert.Equal(t, "text/html", c.Writer.Header().Get("Content-Type"))
	_, exist := c.Writer.Header()["X-Custom"]
	assert.False(t, exist)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestContextHeaders() do?
TestContextHeaders() is a function in the gin codebase, defined in context_test.go.
Where is TestContextHeaders() defined?
TestContextHeaders() is defined in context_test.go at line 1535.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free