Home / Function/ TestRenderProtoBuf() — gin Function Reference

TestRenderProtoBuf() — gin Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

render/render_test.go lines 335–354

func TestRenderProtoBuf(t *testing.T) {
	w := httptest.NewRecorder()
	reps := []int64{int64(1), int64(2)}
	label := "test"
	data := &testdata.Test{
		Label: &label,
		Reps:  reps,
	}

	(ProtoBuf{data}).WriteContentType(w)
	protoData, err := proto.Marshal(data)
	require.NoError(t, err)
	assert.Equal(t, "application/x-protobuf", w.Header().Get("Content-Type"))

	err = (ProtoBuf{data}).Render(w)

	require.NoError(t, err)
	assert.Equal(t, string(protoData), w.Body.String())
	assert.Equal(t, "application/x-protobuf", w.Header().Get("Content-Type"))
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free