Merge pull request #2145 from tractorcow/3.1-controller-redirect

Controller::redirect now returns the resulting SS_HTTPResponse
This commit is contained in:
Sean Harvey 2013-06-24 14:16:18 -07:00
commit 7349682d44

View File

@ -458,6 +458,8 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
/** /**
* Redirect to the given URL. * Redirect to the given URL.
*
* @return SS_HTTPResponse
*/ */
public function redirect($url, $code=302) { public function redirect($url, $code=302) {
if(!$this->response) $this->response = new SS_HTTPResponse(); if(!$this->response) $this->response = new SS_HTTPResponse();
@ -473,7 +475,7 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
$url = Director::baseURL() . $url; $url = Director::baseURL() . $url;
} }
$this->response->redirect($url, $code); return $this->response->redirect($url, $code);
} }
/** /**