Closed Davidbhodge closed 6 years ago
The documentation doesn't list hooks-- I should fix that. Edit: fixed.
Anyway, there's a hook called request
which is triggered when a request is executed, so something like this should do the trick:
(define-trigger radiance:request (request response)
(setf (header "Access-Control-Allow-Origin" response) "*"))
There's no specific trigger for API calls, so you'd have to check the request for the required path if you wanted to limit the effect to that.
ok - sounds good, thanks for the help
For development purposes, i want to say something like (setf (header "Access-Control-Allow-Origin") "*") on all my responses.
At the moment i am doing this in each API and wonder if there is a configuration hook somewhere that I could use?
Cheers