Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #934 from deepj/308-redirect

Rack::Response::Helpers#redirect? would accept 308 status code
commit 6c4160b8c5173299f4b49ea2c9e4aab76f6b9054 2 parents 9792bf5 + 09b8271
@tenderlove tenderlove authored
Showing with 13 additions and 4 deletions.
  1. +1 −1  lib/rack/response.rb
  2. +12 −3 test/spec_response.rb
View
2  lib/rack/response.rb
@@ -129,7 +129,7 @@ def method_not_allowed?; status == 405; end
def precondition_failed?; status == 412; end
def unprocessable?; status == 422; end
- def redirect?; [301, 302, 303, 307].include? status; end
+ def redirect?; [301, 302, 303, 307, 308].include? status; end
def include?(header)
have_header? header
View
15 test/spec_response.rb
@@ -241,6 +241,18 @@ def object_with_each.each
res.must_be :redirect?
res.must_be :moved_permanently?
+ res.status = 302
+ res.must_be :redirect?
+
+ res.status = 303
+ res.must_be :redirect?
+
+ res.status = 307
+ res.must_be :redirect?
+
+ res.status = 308
+ res.must_be :redirect?
+
res.status = 400
res.wont_be :successful?
res.must_be :client_error?
@@ -274,9 +286,6 @@ def object_with_each.each
res.status = 501
res.wont_be :successful?
res.must_be :server_error?
-
- res.status = 307
- res.must_be :redirect?
end
it "provide access to the HTTP headers" do
Please sign in to comment.
Something went wrong with that request. Please try again.