Skip to content
Browse files

Revert "use status code 303 for redirects"

This reverts commit c0eb84f.
  • Loading branch information...
1 parent 6d9d282 commit da5e3333be6a29169e97633d19eb9a3689ca1156 @rkh rkh committed Feb 21, 2011
Showing with 4 additions and 8 deletions.
  1. +0 −2 CHANGES
  2. +1 −3 lib/sinatra/base.rb
  3. +3 −3 test/helpers_test.rb
View
2 CHANGES
@@ -42,8 +42,6 @@
* Improved error handling. (cactus, Konstantin Haase)
- * Use 303 instead of 302 for redirects. (Konstantin Haase)
-
* Skip missing template engines in tests correctly. (cactus)
* Sinatra now ships with a Gemfile for development dependencies, since it eases
View
4 lib/sinatra/base.rb
@@ -95,9 +95,7 @@ def block.each; yield(call) end
# Halt processing and redirect to the URI provided.
def redirect(uri, *args)
- # Browsers treat 302 like 303, even though it should rather be handled
- # like 307. To show our good will, we use 303.
- status 303
+ status 302
# According to RFC 2616 section 14.30, "the field value consists of a
# single absolute URI"
View
6 test/helpers_test.rb
@@ -47,7 +47,7 @@ def test_default
end
describe 'redirect' do
- it 'uses a 303 when only a path is given' do
+ it 'uses a 302 when only a path is given' do
mock_app {
get '/' do
redirect '/foo'
@@ -56,7 +56,7 @@ def test_default
}
get '/'
- assert_equal 303, status
+ assert_equal 302, status
assert_equal '', body
assert_equal 'http://example.org/foo', response['Location']
end
@@ -84,7 +84,7 @@ def test_default
request = Rack::MockRequest.new(@app)
response = request.get('/try_redirect', 'HTTP_REFERER' => '/foo')
- assert_equal 303, response.status
+ assert_equal 302, response.status
assert_equal 'http://example.org/foo', response['Location']
end

0 comments on commit da5e333

Please sign in to comment.
Something went wrong with that request. Please try again.