Fix exporting stdAllowedHeaders

This commit is contained in:
Jeff Mitchell 2017-08-07 15:02:08 -04:00
parent 118dea1ad8
commit 691d00149a
3 changed files with 4 additions and 4 deletions

View File

@ -79,7 +79,7 @@ func TestHandler_cors(t *testing.T) {
//
expHeaders := map[string]string{
"Access-Control-Allow-Origin": addr,
"Access-Control-Allow-Headers": strings.Join(stdAllowedHeaders, ","),
"Access-Control-Allow-Headers": strings.Join(vault.StdAllowedHeaders, ","),
"Access-Control-Max-Age": "300",
"Vary": "Origin",
}

View File

@ -15,7 +15,7 @@ const (
CORSEnabled
)
var stdAllowedHeaders = []string{
var StdAllowedHeaders = []string{
"Content-Type",
"X-Requested-With",
"X-Vault-AWS-IAM-Server-ID",
@ -98,7 +98,7 @@ func (c *CORSConfig) Enable(urls []string, headers []string) error {
c.AllowedOrigins = urls
// Start with the standard headers to Vault accepts.
c.AllowedHeaders = append(c.AllowedHeaders, stdAllowedHeaders...)
c.AllowedHeaders = append(c.AllowedHeaders, StdAllowedHeaders...)
// Allow the user to add additional headers to the list of
// headers allowed on cross-origin requests.

View File

@ -66,7 +66,7 @@ func TestSystemConfigCORS(t *testing.T) {
Data: map[string]interface{}{
"enabled": true,
"allowed_origins": []string{"http://www.example.com"},
"allowed_headers": append(stdAllowedHeaders, "X-Custom-Header"),
"allowed_headers": append(StdAllowedHeaders, "X-Custom-Header"),
},
}