]> git.koha-community.org Git - koha.git/commit
Bug 24384: Add Access-Control-Allow-Origin support to OPAC reports svc
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 9 Jan 2020 14:45:14 +0000 (11:45 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 19 Mar 2020 09:23:13 +0000 (09:23 +0000)
commit53ef5a4078d8d140c6f0d70bd183f56888767ad8
treee77511782e1cc1ca8d8f5fe3b83fafe8ead20aa0
parent0abe936e37cefad5986f14290ca178d68495d323
Bug 24384: Add Access-Control-Allow-Origin support to OPAC reports svc

This patch makes the opac/svc/report script use output_with_http_headers
so it sets the Access-Control-Allow-Origin header.

To test:
1. Create a new public report and remember the report id
2. Use your favourite too to fetch the report in JSON by issuing:
   GET http://localhost:8080/cgi-bin/koha/svc/report?id=1
=> FAIL: There is no Access-Control-Allow-Origin header
3. Apply this patch
4. Restart Plack
   $ sudo koha-plack --restart kohadev
5. Set the AccessControlAllowOrigin to anything (for example,
   https://koha-community.org)
6. Repeat 2
=> SUCCESS: On the response headers you find
Access-Control-Allow-Origin: https://koha-community.org
7. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
opac/svc/report