Exemplo n.º 1
0
 /**
  * Creates an array of cacheable and normalized message headers
  *
  * @param MessageInterface $message
  *
  * @return array
  */
 private function persistHeaders(MessageInterface $message)
 {
     // Headers are excluded from the caching (see RFC 2616:13.5.1)
     static $noCache = array('age' => true, 'connection' => true, 'keep-alive' => true, 'proxy-authenticate' => true, 'proxy-authorization' => true, 'te' => true, 'trailers' => true, 'transfer-encoding' => true, 'upgrade' => true, 'set-cookie' => true, 'set-cookie2' => true);
     // Clone the response to not destroy any necessary headers when caching
     $headers = $message->getHeaders()->getAll();
     $headers = array_diff_key($headers, $noCache);
     // Cast the headers to a string
     $headers = array_map(function ($h) {
         return (string) $h;
     }, $headers);
     return $headers;
 }
Exemplo n.º 2
0
 private function persistHeaders(MessageInterface $message)
 {
     static $noCache = array('age' => true, 'connection' => true, 'keep-alive' => true, 'proxy-authenticate' => true, 'proxy-authorization' => true, 'te' => true, 'trailers' => true, 'transfer-encoding' => true, 'upgrade' => true, 'set-cookie' => true, 'set-cookie2' => true);
     $headers = $message->getHeaders()->getAll();
     $headers = array_diff_key($headers, $noCache);
     $headers = array_map(function ($h) {
         return (string) $h;
     }, $headers);
     return $headers;
 }