TestContextNegotiationWithHTML() — gin Function Reference
Architecture documentation for the TestContextNegotiationWithHTML() function in context_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD bd85e5f4_e2f0_e322_ff15_0811c0560ac5["TestContextNegotiationWithHTML()"] ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"] bd85e5f4_e2f0_e322_ff15_0811c0560ac5 -->|defined in| ebe0ae48_a62b_a38f_5bac_5bbbd96fc508 style bd85e5f4_e2f0_e322_ff15_0811c0560ac5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
context_test.go lines 1661–1677
func TestContextNegotiationWithHTML(t *testing.T) {
w := httptest.NewRecorder()
c, router := CreateTestContext(w)
c.Request, _ = http.NewRequest(http.MethodPost, "", nil)
templ := template.Must(template.New("t").Parse(`Hello {{.name}}`))
router.SetHTMLTemplate(templ)
c.Negotiate(http.StatusOK, Negotiate{
Offered: []string{MIMEHTML},
Data: H{"name": "gin"},
HTMLName: "t",
})
assert.Equal(t, http.StatusOK, w.Code)
assert.Equal(t, "Hello gin", w.Body.String())
assert.Equal(t, "text/html; charset=utf-8", w.Header().Get("Content-Type"))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestContextNegotiationWithHTML() do?
TestContextNegotiationWithHTML() is a function in the gin codebase, defined in context_test.go.
Where is TestContextNegotiationWithHTML() defined?
TestContextNegotiationWithHTML() is defined in context_test.go at line 1661.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free