Home / Function/ TestContextRenderFileFromFS() — gin Function Reference

TestContextRenderFileFromFS() — gin Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

context_test.go lines 1430–1443

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

	c.Request, _ = http.NewRequest(http.MethodGet, "/some/path", nil)
	c.FileFromFS("./gin.go", Dir(".", false))

	assert.Equal(t, http.StatusOK, w.Code)
	assert.Contains(t, w.Body.String(), "func New(opts ...OptionFunc) *Engine {")
	// Content-Type='text/plain; charset=utf-8' when go version <= 1.16,
	// else, Content-Type='text/x-go; charset=utf-8'
	assert.NotEmpty(t, w.Header().Get("Content-Type"))
	assert.Equal(t, "/some/path", c.Request.URL.Path)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free