mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-12 06:18:19 +02:00
config: simplify default set response headers (#4212)
config: simplify default set response headers (#4196) Co-authored-by: Caleb Doxsey <cdoxsey@pomerium.com>
This commit is contained in:
parent
6efd1d6bc9
commit
ab115b679a
8 changed files with 60 additions and 80 deletions
|
@ -749,20 +749,21 @@ func TestOptions_GetSetResponseHeaders(t *testing.T) {
|
|||
assert.Equal(t, map[string]string{
|
||||
"X-Frame-Options": "SAMEORIGIN",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
}, options.GetSetResponseHeaders(false))
|
||||
}, options.GetSetResponseHeaders())
|
||||
})
|
||||
t.Run("strict", func(t *testing.T) {
|
||||
options := NewDefaultOptions()
|
||||
options.Cert = "CERT"
|
||||
assert.Equal(t, map[string]string{
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
|
||||
"X-Frame-Options": "SAMEORIGIN",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
}, options.GetSetResponseHeaders(true))
|
||||
}, options.GetSetResponseHeaders())
|
||||
})
|
||||
t.Run("disable", func(t *testing.T) {
|
||||
options := NewDefaultOptions()
|
||||
options.SetResponseHeaders = map[string]string{DisableHeaderKey: "1", "x-other": "xyz"}
|
||||
assert.Equal(t, map[string]string{}, options.GetSetResponseHeaders(true))
|
||||
assert.Equal(t, map[string]string{}, options.GetSetResponseHeaders())
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -773,7 +774,7 @@ func TestOptions_GetSetResponseHeadersForPolicy(t *testing.T) {
|
|||
policy := &Policy{
|
||||
SetResponseHeaders: map[string]string{"x": "y"},
|
||||
}
|
||||
assert.Equal(t, map[string]string{"x": "y"}, options.GetSetResponseHeadersForPolicy(policy, true))
|
||||
assert.Equal(t, map[string]string{"x": "y"}, options.GetSetResponseHeadersForPolicy(policy))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue