Browse Source

Merge pull request #5742 from cakephp/3.0-redirecting

Set 302 as default argument for redirects.
Mark Story 11 years ago
parent
commit
9d1cbafcdf
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/Controller/Controller.php

+ 3 - 3
src/Controller/Controller.php

@@ -497,16 +497,16 @@ class Controller implements EventListenerInterface
      *
      * @param string|array $url A string or array-based URL pointing to another location within the app,
      *     or an absolute URL
-     * @param int $status Optional HTTP status code (eg: 404)
+     * @param int $status HTTP status code (eg: 301)
      * @return void|\Cake\Network\Response
      * @link http://book.cakephp.org/3.0/en/controllers.html#Controller::redirect
      */
-    public function redirect($url, $status = null)
+    public function redirect($url, $status = 302)
     {
         $this->autoRender = false;
 
         $response = $this->response;
-        if ($status && $response->statusCode() === 200) {
+        if ($status) {
             $response->statusCode($status);
         }