TestContextNegotiationWithPROTOBUF() — gin Function Reference
Architecture documentation for the TestContextNegotiationWithPROTOBUF() function in context_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 42217ce0_43c4_7a92_c5d9_2d3790c4f96a["TestContextNegotiationWithPROTOBUF()"] ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"] 42217ce0_43c4_7a92_c5d9_2d3790c4f96a -->|defined in| ebe0ae48_a62b_a38f_5bac_5bbbd96fc508 style 42217ce0_43c4_7a92_c5d9_2d3790c4f96a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
context_test.go lines 1679–1703
func TestContextNegotiationWithPROTOBUF(t *testing.T) {
w := httptest.NewRecorder()
c, _ := CreateTestContext(w)
c.Request = httptest.NewRequest(http.MethodPost, "/", nil)
reps := []int64{int64(1), int64(2)}
label := "test"
data := &testdata.Test{
Label: &label,
Reps: reps,
}
c.Negotiate(http.StatusCreated, Negotiate{
Offered: []string{MIMEPROTOBUF, MIMEJSON, MIMEXML},
Data: data,
})
// Marshal original data for comparison
protoData, err := proto.Marshal(data)
require.NoError(t, err)
assert.Equal(t, http.StatusCreated, w.Code)
assert.Equal(t, string(protoData), w.Body.String())
assert.Equal(t, "application/x-protobuf", w.Header().Get("Content-Type"))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestContextNegotiationWithPROTOBUF() do?
TestContextNegotiationWithPROTOBUF() is a function in the gin codebase, defined in context_test.go.
Where is TestContextNegotiationWithPROTOBUF() defined?
TestContextNegotiationWithPROTOBUF() is defined in context_test.go at line 1679.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free