<?php
namespace Api\EventListener;
use Api\Request\ApiRequest;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
class RequestListener {
private $apiRequest;
public function __construct(ApiRequest $apiRequest)
{
$this->apiRequest = $apiRequest;
}
public function onKernelResponse(ResponseEvent $event)
{
$response = $event->getResponse();
foreach ($this->apiRequest->getResponseHeaders() as $headerKey => $headerValue) {
$response->headers->set($headerKey, $headerValue);
}
}
}