Explorar el Código

[HttpFoundation] added Response::setVary()

Fabien Potencier hace 14 años
padre
commit
dd9b77ed96
Se han modificado 1 ficheros con 12 adiciones y 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);
     }
 
     /**