TestSecureRequestDump() — gin Function Reference
Architecture documentation for the TestSecureRequestDump() function in recovery_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD e78cb905_a0ea_a067_3b1f_73d4a0e0d93d["TestSecureRequestDump()"] c9a553a7_05a4_91a7_23b0_924f9f59d021["recovery_test.go"] e78cb905_a0ea_a067_3b1f_73d4a0e0d93d -->|defined in| c9a553a7_05a4_91a7_23b0_924f9f59d021 style e78cb905_a0ea_a067_3b1f_73d4a0e0d93d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
recovery_test.go lines 259–319
func TestSecureRequestDump(t *testing.T) {
tests := []struct {
name string
req *http.Request
wantContains string
wantNotContain string
}{
{
name: "Authorization header standard case",
req: func() *http.Request {
r, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
r.Header.Set("Authorization", "Bearer secret-token")
return r
}(),
wantContains: "Authorization: *",
wantNotContain: "Bearer secret-token",
},
{
name: "authorization header lowercase",
req: func() *http.Request {
r, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
r.Header.Set("authorization", "some-secret")
return r
}(),
wantContains: "Authorization: *",
wantNotContain: "some-secret",
},
{
name: "Authorization header mixed case",
req: func() *http.Request {
r, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
r.Header.Set("AuThOrIzAtIoN", "token123")
return r
}(),
wantContains: "Authorization: *",
wantNotContain: "token123",
},
{
name: "No Authorization header",
req: func() *http.Request {
r, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
r.Header.Set("Content-Type", "application/json")
return r
}(),
wantContains: "",
wantNotContain: "Authorization: *",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := secureRequestDump(tt.req)
if tt.wantContains != "" && !strings.Contains(result, tt.wantContains) {
t.Errorf("maskHeaders() = %q, want contains %q", result, tt.wantContains)
}
if tt.wantNotContain != "" && strings.Contains(result, tt.wantNotContain) {
t.Errorf("maskHeaders() = %q, want NOT contain %q", result, tt.wantNotContain)
}
})
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestSecureRequestDump() do?
TestSecureRequestDump() is a function in the gin codebase, defined in recovery_test.go.
Where is TestSecureRequestDump() defined?
TestSecureRequestDump() is defined in recovery_test.go at line 259.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free