From a78a75d67a8072bc7613edbed548d4b865daadf8 Mon Sep 17 00:00:00 2001 From: Jim Herzberg Date: Tue, 11 Oct 2011 17:46:24 -0700 Subject: activeresource should treat HTTP status 307 as redirection, same as 301 and 302; added missing test cases for statii 301 and 302. --- activeresource/lib/active_resource/base.rb | 4 ++-- activeresource/lib/active_resource/connection.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'activeresource/lib') diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index 03c4cc5b9e..3fb8ce7790 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -170,8 +170,8 @@ module ActiveResource # 404 is just one of the HTTP error response codes that Active Resource will handle with its own exception. The # following HTTP response codes will also result in these exceptions: # - # * 200..399 - Valid response, no exception (other than 301, 302) - # * 301, 302 - ActiveResource::Redirection + # * 200..399 - Valid response, no exception (other than 301, 302 and 307) + # * 301, 302, 307 - ActiveResource::Redirection # * 400 - ActiveResource::BadRequest # * 401 - ActiveResource::UnauthorizedAccess # * 403 - ActiveResource::ForbiddenAccess diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb index 592fca96a4..73410c2d82 100644 --- a/activeresource/lib/active_resource/connection.rb +++ b/activeresource/lib/active_resource/connection.rb @@ -122,7 +122,7 @@ module ActiveResource # Handles response and error codes from the remote service. def handle_response(response) case response.code.to_i - when 301,302 + when 301,302,307 raise(Redirection.new(response)) when 200...400 response -- cgit v1.2.3