/**
* Sends HTTP headers.
*
* @param ReactResponse $response
* @param SymfonyResponse $sf_response
*/
private function sendHeaders(ReactResponse $response, SymfonyResponse $sf_response)
{
// date
if (!$sf_response->headers->has('Date')) {
$sf_response->setDate(\DateTime::createFromFormat('U', time()));
}
$headers = $sf_response->headers->allPreserveCase();
// cookies
foreach ($sf_response->headers->getCookies() as $cookie) {
if (!isset($headers['Set-Cookie'])) {
$headers['Set-Cookie'] = [];
}
$headers['Set-Cookie'][] = (string) $cookie;
}
$response->writeHead($sf_response->getStatusCode(), $headers);
}