소스 검색

[HttpFoundation] added Response::setVary()

Fabien Potencier 14 년 전
부모
커밋
dd9b77ed96
1개의 변경된 파일12개의 추가작업 그리고 1개의 파일을 삭제
  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);
     }
 
     /**