TestContextAbortWithStatusPureJSON() — gin Function Reference
Architecture documentation for the TestContextAbortWithStatusPureJSON() function in context_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD c063d5e1_7b3a_7b57_d27b_053bb3aae3e2["TestContextAbortWithStatusPureJSON()"] ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"] c063d5e1_7b3a_7b57_d27b_053bb3aae3e2 -->|defined in| ebe0ae48_a62b_a38f_5bac_5bbbd96fc508 style c063d5e1_7b3a_7b57_d27b_053bb3aae3e2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
context_test.go lines 1860–1884
func TestContextAbortWithStatusPureJSON(t *testing.T) {
w := httptest.NewRecorder()
c, _ := CreateTestContext(w)
c.index = 4
in := new(testJSONAbortMsg)
in.Bar = "barValue"
in.Foo = "fooValue"
c.AbortWithStatusPureJSON(http.StatusUnsupportedMediaType, in)
assert.Equal(t, abortIndex, c.index)
assert.Equal(t, http.StatusUnsupportedMediaType, c.Writer.Status())
assert.Equal(t, http.StatusUnsupportedMediaType, w.Code)
assert.True(t, c.IsAborted())
contentType := w.Header().Get("Content-Type")
assert.Equal(t, "application/json; charset=utf-8", contentType)
buf := new(bytes.Buffer)
_, err := buf.ReadFrom(w.Body)
require.NoError(t, err)
jsonStringBody := buf.String()
assert.JSONEq(t, "{\"foo\":\"fooValue\",\"bar\":\"barValue\"}", jsonStringBody)
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestContextAbortWithStatusPureJSON() do?
TestContextAbortWithStatusPureJSON() is a function in the gin codebase, defined in context_test.go.
Where is TestContextAbortWithStatusPureJSON() defined?
TestContextAbortWithStatusPureJSON() is defined in context_test.go at line 1860.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free