Bug 24369: Add CORS support to the API
commit1af4010ff7344b12c193c9beb8a33f05125e7bf7
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 9 Jan 2020 14:13:47 +0000 (9 11:13 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 5 Mar 2020 12:59:50 +0000 (5 12:59 +0000)
tree7b8373f7c256d923801884efcf95b5387dbf0af7
parentc951f8e06a8db91308b85f2610ee9a8c4d89297a
Bug 24369: Add CORS support to the API

This patch adds CORS support for API requests. It uses the
AccessControlAllowOrigin syspref. To test:

1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/auth.t
=> SUCCESS: Tests pass!
3. Set the AccessControlAllowOrigin to any string (for example, *)
4. Use any API testing tool (Postman?) to place a request on the API
=> SUCCESS: The response headers include Access-Control-Allow-Origin,
    containing what you set on the syspref
5. Sign off :-D

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/V1.pm
t/db_dependent/api/v1/auth.t