FIX: Add User Api Key headers to CORS

- add User-Api-Key and User-Api-Client-Id to Access-Control-Allow-Headers
- update test
This commit is contained in:
Davide Porrovecchio 2018-07-24 02:28:23 +02:00 committed by Sam
parent c9d4288214
commit dd9d815178
2 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ class Discourse::Cors
end
headers['Access-Control-Allow-Origin'] = origin || cors_origins[0]
headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-CSRF-Token, Discourse-Visible'
headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-CSRF-Token, Discourse-Visible, User-Api-Key, User-Api-Client-Id'
headers['Access-Control-Allow-Credentials'] = 'true'
end

View File

@ -107,7 +107,7 @@ describe Hijack do
expected = {
"Access-Control-Allow-Origin" => "www.rainbows.com",
"Access-Control-Allow-Headers" => "X-Requested-With, X-CSRF-Token, Discourse-Visible",
"Access-Control-Allow-Headers" => "X-Requested-With, X-CSRF-Token, Discourse-Visible, User-Api-Key, User-Api-Client-Id",
"Access-Control-Allow-Credentials" => "true"
}