Home / Function/ TestRenderJsonpJSONError2() — gin Function Reference

TestRenderJsonpJSONError2() — gin Function Reference

Architecture documentation for the TestRenderJsonpJSONError2() function in render_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  8678f214_8ba7_80cc_da27_e7316fa9bfae["TestRenderJsonpJSONError2()"]
  067a4839_481a_7bd8_fc59_5c8c3313879c["render_test.go"]
  8678f214_8ba7_80cc_da27_e7316fa9bfae -->|defined in| 067a4839_481a_7bd8_fc59_5c8c3313879c
  style 8678f214_8ba7_80cc_da27_e7316fa9bfae fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

render/render_test.go lines 187–200

func TestRenderJsonpJSONError2(t *testing.T) {
	w := httptest.NewRecorder()
	data := map[string]any{
		"foo": "bar",
	}
	(JsonpJSON{"", data}).WriteContentType(w)
	assert.Equal(t, "application/javascript; charset=utf-8", w.Header().Get("Content-Type"))

	e := (JsonpJSON{"", data}).Render(w)
	require.NoError(t, e)

	assert.JSONEq(t, "{\"foo\":\"bar\"}", w.Body.String())
	assert.Equal(t, "application/javascript; charset=utf-8", w.Header().Get("Content-Type"))
}

Subdomains

Frequently Asked Questions

What does TestRenderJsonpJSONError2() do?
TestRenderJsonpJSONError2() is a function in the gin codebase, defined in render/render_test.go.
Where is TestRenderJsonpJSONError2() defined?
TestRenderJsonpJSONError2() is defined in render/render_test.go at line 187.

Analyze Your Own Codebase

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

Try Supermodel Free