TestRenderJsonpJSON() — gin Function Reference
Architecture documentation for the TestRenderJsonpJSON() function in render_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD ffc9ddcc_f668_5262_0247_9228720a284a["TestRenderJsonpJSON()"] 067a4839_481a_7bd8_fc59_5c8c3313879c["render_test.go"] ffc9ddcc_f668_5262_0247_9228720a284a -->|defined in| 067a4839_481a_7bd8_fc59_5c8c3313879c style ffc9ddcc_f668_5262_0247_9228720a284a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
render/render_test.go lines 114–140
func TestRenderJsonpJSON(t *testing.T) {
w1 := httptest.NewRecorder()
data := map[string]any{
"foo": "bar",
}
(JsonpJSON{"x", data}).WriteContentType(w1)
assert.Equal(t, "application/javascript; charset=utf-8", w1.Header().Get("Content-Type"))
err1 := (JsonpJSON{"x", data}).Render(w1)
require.NoError(t, err1)
assert.Equal(t, "x({\"foo\":\"bar\"});", w1.Body.String())
assert.Equal(t, "application/javascript; charset=utf-8", w1.Header().Get("Content-Type"))
w2 := httptest.NewRecorder()
datas := []map[string]any{{
"foo": "bar",
}, {
"bar": "foo",
}}
err2 := (JsonpJSON{"x", datas}).Render(w2)
require.NoError(t, err2)
assert.Equal(t, "x([{\"foo\":\"bar\"},{\"bar\":\"foo\"}]);", w2.Body.String())
assert.Equal(t, "application/javascript; charset=utf-8", w2.Header().Get("Content-Type"))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestRenderJsonpJSON() do?
TestRenderJsonpJSON() is a function in the gin codebase, defined in render/render_test.go.
Where is TestRenderJsonpJSON() defined?
TestRenderJsonpJSON() is defined in render/render_test.go at line 114.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free