Home / Function/ TestRenderBSON() — gin Function Reference

TestRenderBSON() — gin Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

render/render_test.go lines 363–386

func TestRenderBSON(t *testing.T) {
	w := httptest.NewRecorder()
	reps := []int64{int64(1), int64(2)}
	type mystruct struct {
		Label string
		Reps  []int64
	}

	data := &mystruct{
		Label: "test",
		Reps:  reps,
	}

	(BSON{data}).WriteContentType(w)
	bsonData, err := bson.Marshal(data)
	require.NoError(t, err)
	assert.Equal(t, "application/bson", w.Header().Get("Content-Type"))

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

	require.NoError(t, err)
	assert.Equal(t, bsonData, w.Body.Bytes())
	assert.Equal(t, "application/bson", w.Header().Get("Content-Type"))
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free