Commit 64ad8e38 authored by David Lawrence's avatar David Lawrence

Bug 1141440: OPTION response for CORS requests to REST doesn't allow X-Bugzilla headers

- Fixed t/001compile.t error due to tr///r only for 5.14+
parent cd00796d
...@@ -134,8 +134,13 @@ sub response { ...@@ -134,8 +134,13 @@ sub response {
{ rpc => $self, result => \$result, response => $response }); { rpc => $self, result => \$result, response => $response });
# Access Control # Access Control
my @allowed_headers = (qw(accept content-type origin x-requested-with), my @allowed_headers = qw(accept content-type origin x-requested-with);
map { tr/A-Z_/a-z\-/r } keys API_AUTH_HEADERS()); foreach my $header (keys API_AUTH_HEADERS()) {
# We want to lowercase and replace _ with -
my $translated_header = $header;
$translated_header =~ tr/A-Z_/a-z\-/;
push(@allowed_headers, $translated_header);
}
$response->header("Access-Control-Allow-Origin", "*"); $response->header("Access-Control-Allow-Origin", "*");
$response->header("Access-Control-Allow-Headers", join(', ', @allowed_headers)); $response->header("Access-Control-Allow-Headers", join(', ', @allowed_headers));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment