TestContextRenderAndEscapeAttachment() — gin Function Reference
Architecture documentation for the TestContextRenderAndEscapeAttachment() function in context_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD f09875c2_6c7b_9553_efe1_d2d930c55826["TestContextRenderAndEscapeAttachment()"] ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"] f09875c2_6c7b_9553_efe1_d2d930c55826 -->|defined in| ebe0ae48_a62b_a38f_5bac_5bbbd96fc508 style f09875c2_6c7b_9553_efe1_d2d930c55826 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
context_test.go lines 1458–1470
func TestContextRenderAndEscapeAttachment(t *testing.T) {
w := httptest.NewRecorder()
c, _ := CreateTestContext(w)
maliciousFilename := "tampering_field.sh\"; \\\"; dummy=.go"
actualEscapedResponseFilename := "tampering_field.sh\\\"; \\\\\\\"; dummy=.go"
c.Request, _ = http.NewRequest(http.MethodGet, "/", nil)
c.FileAttachment("./gin.go", maliciousFilename)
assert.Equal(t, 200, w.Code)
assert.Contains(t, w.Body.String(), "func New(opts ...OptionFunc) *Engine {")
assert.Equal(t, fmt.Sprintf("attachment; filename=\"%s\"", actualEscapedResponseFilename), w.Header().Get("Content-Disposition"))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestContextRenderAndEscapeAttachment() do?
TestContextRenderAndEscapeAttachment() is a function in the gin codebase, defined in context_test.go.
Where is TestContextRenderAndEscapeAttachment() defined?
TestContextRenderAndEscapeAttachment() is defined in context_test.go at line 1458.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free