Home / Function/ TestContextRenderProtoBuf() — gin Function Reference

TestContextRenderProtoBuf() — gin Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

context_test.go lines 1514–1533

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

	reps := []int64{int64(1), int64(2)}
	label := "test"
	data := &testdata.Test{
		Label: &label,
		Reps:  reps,
	}

	c.ProtoBuf(http.StatusCreated, data)

	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

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free