Home / Function/ TestRenderReaderNoContentLength() — gin Function Reference

TestRenderReaderNoContentLength() — gin Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

render/render_test.go lines 620–641

func TestRenderReaderNoContentLength(t *testing.T) {
	w := httptest.NewRecorder()

	body := "#!PNG some raw data"
	headers := make(map[string]string)
	headers["Content-Disposition"] = `attachment; filename="filename.png"`
	headers["x-request-id"] = "requestId"

	err := (Reader{
		ContentLength: -1,
		ContentType:   "image/png",
		Reader:        strings.NewReader(body),
		Headers:       headers,
	}).Render(w)

	require.NoError(t, err)
	assert.Equal(t, body, w.Body.String())
	assert.Equal(t, "image/png", w.Header().Get("Content-Type"))
	assert.NotContains(t, "Content-Length", w.Header())
	assert.Equal(t, headers["Content-Disposition"], w.Header().Get("Content-Disposition"))
	assert.Equal(t, headers["x-request-id"], w.Header().Get("x-request-id"))
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free