apioo / fusio

Open source API management platform
https://www.fusio-project.org
Apache License 2.0
1.87k stars 223 forks source link

Util-Chain and PHP-Sandbox (Custom Headers) #546

Closed vincenzo84 closed 8 months ago

vincenzo84 commented 8 months ago

In a PHP-Sandbox action that is called within a Util-Chain, how do I add a header that is available in all responses in the chain?

Thank you

vincenzo84 commented 8 months ago

Found it, just add this:

$requestContext = $request->getContext();
$httpRequest = $requestContext->getRequest();
$headers = $httpRequest->getHeaders();
$httpRequest->addHeader('key', 'value');

Thank you