Home / Function/ TestContextRenderHTML() — gin Function Reference

TestContextRenderHTML() — gin Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

context_test.go lines 1245–1257

func TestContextRenderHTML(t *testing.T) {
	w := httptest.NewRecorder()
	c, router := CreateTestContext(w)

	templ := template.Must(template.New("t").Parse(`Hello {{.name}}`))
	router.SetHTMLTemplate(templ)

	c.HTML(http.StatusCreated, "t", H{"name": "alexandernyquist"})

	assert.Equal(t, http.StatusCreated, w.Code)
	assert.Equal(t, "Hello alexandernyquist", w.Body.String())
	assert.Equal(t, "text/html; charset=utf-8", w.Header().Get("Content-Type"))
}

Domain

Subdomains

Defined In

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free