lib/restclient/abstract_response.rb
def return!(&block)
      case code
      when 200..207
        self
      when 301, 302, 307
        case request.method
        when 'get', 'head'
          check_max_redirects
          follow_redirection(&block)
        else
          raise exception_with_response
        end
      when 303
        check_max_redirects
        follow_get_redirection(&block)
      else
        raise exception_with_response
      end
    end
def return!(&block)
      case code
      when 200..207
        self
      when 301, 302, 307
        case request.method
        when 'get', 'head'
          check_max_redirects
          follow_redirection(&block)
        else
          raise exception_with_response
        end
      when 303
        check_max_redirects
        follow_get_redirection(&block)
      else
        raise exception_with_response
      end
    end
Return the default behavior corresponding to the response code:

 For 20x status codes: return the response itself

 For 30x status codes:
   301, 302, 307: redirect GET / HEAD if there is a Location header
   303: redirect, changing method to GET, if there is a Location header

 For all other responses, raise a response exception