Explorar o código

[HttpFoundation] added Response::setVary()

Fabien Potencier %!s(int64=14) %!d(string=hai) anos
pai
achega
dd9b77ed96
Modificáronse 1 ficheiros con 12 adicións e 1 borrados
  1. 12 1
      src/Symfony/Component/HttpFoundation/Response.php

+ 12 - 1
src/Symfony/Component/HttpFoundation/Response.php

@@ -580,7 +580,18 @@ class Response
             return array();
         }
 
-        return preg_split('/[\s,]+/', $vary);
+        return is_array($vary) ? $vary : preg_split('/[\s,]+/', $vary);
+    }
+
+    /**
+     * Sets the Vary header.
+     *
+     * @param string|array $headers
+     * @param Boolean      $replace Whether to replace the actual value of not (true by default)
+     */
+    public function setVary($headers, $replace = true)
+    {
+        $this->headers->set('Vary', $headers, $replace);
     }
 
     /**