summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/zero/response.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/zero/response.rb b/lib/zero/response.rb
index 24c1aaf..a3e1651 100644
--- a/lib/zero/response.rb
+++ b/lib/zero/response.rb
@@ -67,5 +67,14 @@ module Zero
self.header['Content-Type'] = value
end
+ # Sets the Location header to the given URL and the status code to 302.
+ #
+ # @param [String] location Redirect URL
+ #
+ def redirect(location)
+ self.status = 302
+ self.header['Location'] = location
+ end
+
end
end