Преглед на файлове

[HttpKernel] Allow any 2xx response code in a subrequest

Igor Wiedler преди 14 години
родител
ревизия
e929bc5d1b
променени са 2 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 1 1
      src/Symfony/Component/HttpKernel/HttpCache/Esi.php
  2. 1 1
      src/Symfony/Component/HttpKernel/bootstrap_cache.php

+ 1 - 1
src/Symfony/Component/HttpKernel/HttpCache/Esi.php

@@ -179,7 +179,7 @@ class Esi
         try {
             $response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);
 
-            if (200 != $response->getStatusCode()) {
+            if (!$response->isSuccessful()) {
                 throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $subRequest->getUri(), $response->getStatusCode()));
             }
 

+ 1 - 1
src/Symfony/Component/HttpKernel/bootstrap_cache.php

@@ -1028,7 +1028,7 @@ class Esi
         $subRequest = Request::create($uri, 'get', array(), $cache->getRequest()->cookies->all(), array(), $cache->getRequest()->server->all());
         try {
             $response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);
-            if (200 != $response->getStatusCode()) {
+            if (!$response->isSuccessful()) {
                 throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $subRequest->getUri(), $response->getStatusCode()));
             }
             return $response->getContent();