Permalink
Browse files

Redirects without views no longer result in errors.

  • Loading branch information...
1 parent bb2977d commit 770f5a3bdc00f0a12629285b61613a27f45b267e Kris Jordan committed with KrisJordan Jan 4, 2010
@@ -5,6 +5,7 @@
Library::import('recess.framework.views.JsonView');
Library::import('recess.framework.interfaces.IPolicy');
Library::import('recess.framework.http.MimeTypes');
+Library::import('recess.framework.views.EmptyView');
// TODO: Remove this import in 0.3
Library::import('recess.framework.views.RecessView');
@@ -81,6 +82,10 @@ public function getViewFor(Response $response) {
}
} while ($format !== false);
+ if($response->code >= 300 && $response->code < 400) {
+ return new EmptyView();
+ }
+
if(isset($response->meta->viewName)) {
if(isset($response->meta->viewsPrefix)) {
$view = $response->meta->viewsPrefix . $response->meta->viewName;
@@ -0,0 +1,14 @@
+<?php
+Library::import('recess.framework.AbstractView');
+
+class EmptyView extends AbstractView {
+
+ public function canRespondWith(Response $response) {
+ return true;
+ }
+
+ protected function render(Response $response) {
+ // No-op.
+ }
+}
+?>

0 comments on commit 770f5a3

Please sign in to comment.