Skip to content

Commit

Permalink
add X-LaunchDarkly-Payload-ID and Cache-Control to allowable CORS hea…
Browse files Browse the repository at this point in the history
…ders for JS (#112)
  • Loading branch information
eli-darkly authored Jan 15, 2020
1 parent 3d7e7e1 commit d0605f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions client-side.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ func (m clientSideMux) getGoals(w http.ResponseWriter, req *http.Request) {
}

var allowedHeadersList = []string{
"Cache-Control",
"Content-Type",
"Content-Length",
"Accept-Encoding",
"X-LaunchDarkly-User-Agent",
"X-LaunchDarkly-Payload-ID",
"X-LaunchDarkly-Wrapper",
events.EventSchemaHeader,
}

Expand Down
2 changes: 1 addition & 1 deletion relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func TestCorsMiddlewareSetsCorrectDefaultHeaders(t *testing.T) {
assert.Equal(t, w.Header().Get("Access-Control-Allow-Origin"), "*")
assert.Equal(t, w.Header().Get("Access-Control-Allow-Credentials"), "false")
assert.Equal(t, w.Header().Get("Access-Control-Max-Age"), "300")
assert.Equal(t, w.Header().Get("Access-Control-Allow-Headers"), "Content-Type,Content-Length,Accept-Encoding,X-LaunchDarkly-User-Agent,"+events.EventSchemaHeader)
assert.Equal(t, w.Header().Get("Access-Control-Allow-Headers"), "Cache-Control,Content-Type,Content-Length,Accept-Encoding,X-LaunchDarkly-User-Agent,X-LaunchDarkly-Payload-ID,X-LaunchDarkly-Wrapper,"+events.EventSchemaHeader)
assert.Equal(t, w.Header().Get("Access-Control-Expose-Headers"), "Date")
})).ServeHTTP(resp, req)
}
Expand Down

0 comments on commit d0605f9

Please sign in to comment.