I need to add the a custom header to the ElementAPI endpoints I setup but I want to avoid editing the source of the plugin. What is the best way to go about this?
The ElementAPI plugin returns some default headers by using:
JsonHelper::sendJsonHeaders()
To quickly achieve what I needed I added the following to the ElementApiControllor.php
:
HeaderHelper::setHeader(['Surrogate-Control: max-age=300'])
This works for now but I'd love to learn how to extend existing plugins that don't have any documented hooks with my own if it is possible.