Browse Source

[HttpFoundation] added Response::setVary()

Fabien Potencier 14 years ago
parent
commit
dd9b77ed96
1 changed files with 12 additions and 1 deletions
  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);
     }
 
     /**