Bug 25444: Simplify the code using a loop
[koha-ffzg.git] / C4 / Output.pm
index f8f8e13..921c3a4 100644 (file)
@@ -25,8 +25,7 @@ package C4::Output;
 # NOTE: I'm pretty sure this module is deprecated in favor of
 # templates.
 
-use strict;
-#use warnings; FIXME - Bug 2505
+use Modern::Perl;
 
 use URI::Escape;
 use Scalar::Util qw( looks_like_number );
@@ -275,6 +274,8 @@ sub output_with_http_headers {
         'X-Frame-Options' => 'SAMEORIGIN',
     };
     $options->{expires} = 'now' if $extra_options->{force_no_caching};
+    $options->{'Access-Control-Allow-Origin'} = C4::Context->preference('AccessControlAllowOrigin')
+        if C4::Context->preference('AccessControlAllowOrigin');
 
     $options->{cookie} = $cookie if $cookie;
     if ($content_type eq 'html') {  # guaranteed to be one of the content_type_map keys, else we'd have died