예제 #1
0
 public function handle(Event $event, Response $response)
 {
     if (HttpKernelInterface::MASTER_REQUEST !== $event->getParameter('request_type')) {
         return $response;
     }
     $request = $event->getParameter('request');
     if ('3' === substr($response->getStatusCode(), 0, 1) || $response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html') || 'html' !== $request->getRequestFormat() || $request->isXmlHttpRequest()) {
         return $response;
     }
     $response->setContent($this->injectToolbar($request, $response));
     return $response;
 }
예제 #2
0
파일: Store.php 프로젝트: bill97420/symfony
 /**
  * Persists the Response HTTP headers.
  *
  * @param Symfony\Components\HttpFoundation\Response $response A Response instance
  *
  * @return array An array of HTTP headers
  */
 protected function persistResponse(Response $response)
 {
     $headers = $response->headers->all();
     $headers['X-Status'] = array($response->getStatusCode());
     return $headers;
 }