mirror of
https://github.com/rest-client/rest-client.git
synced 2022-11-09 13:49:40 -05:00
Drop some 2008-era backwards compatibility.
These constants and methods have been deprecated for 5+ years, and should no longer be used.
This commit is contained in:
parent
1affca3412
commit
4a92558bd2
2 changed files with 1 additions and 37 deletions
|
@ -66,18 +66,6 @@ module RestClient
|
|||
511 => 'Network Authentication Required', # RFC6585
|
||||
}
|
||||
|
||||
# Compatibility : make the Response act like a Net::HTTPResponse when needed
|
||||
module ResponseForException
|
||||
def method_missing symbol, *args
|
||||
if net_http_res.respond_to? symbol
|
||||
warn "[warning] The response contained in an RestClient::Exception is now a RestClient::Response instead of a Net::HTTPResponse, please update your code"
|
||||
net_http_res.send symbol, *args
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# This is the base RestClient exception class. Rescue it if you want to
|
||||
# catch any exception that your request might raise
|
||||
# You can get the status code by e.http_code, or see anything about the
|
||||
|
@ -93,9 +81,6 @@ module RestClient
|
|||
@response = response
|
||||
@message = nil
|
||||
@initial_response_code = initial_response_code
|
||||
|
||||
# compatibility: this make the exception behave like a Net::HTTPResponse
|
||||
response.extend ResponseForException if response
|
||||
end
|
||||
|
||||
def http_code
|
||||
|
@ -227,10 +212,3 @@ module RestClient
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
class RestClient::Request
|
||||
# backwards compatibility
|
||||
Redirect = RestClient::Redirect
|
||||
Unauthorized = RestClient::Unauthorized
|
||||
RequestFailed = RestClient::RequestFailed
|
||||
end
|
||||
|
|
|
@ -67,22 +67,8 @@ describe RestClient::ResourceNotFound do
|
|||
e.response.should eq response
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "backwards compatibility" do
|
||||
it "alias RestClient::Request::Redirect to RestClient::Redirect" do
|
||||
RestClient::Request::Redirect.should eq RestClient::Redirect
|
||||
end
|
||||
|
||||
it "alias RestClient::Request::Unauthorized to RestClient::Unauthorized" do
|
||||
RestClient::Request::Unauthorized.should eq RestClient::Unauthorized
|
||||
end
|
||||
|
||||
it "alias RestClient::Request::RequestFailed to RestClient::RequestFailed" do
|
||||
RestClient::Request::RequestFailed.should eq RestClient::RequestFailed
|
||||
end
|
||||
|
||||
it "make the exception's response act like an Net::HTTPResponse" do
|
||||
it 'stores the body on the response of the exception' do
|
||||
body = "body"
|
||||
stub_request(:get, "www.example.com").to_return(:body => body, :status => 404)
|
||||
begin
|
||||
|
|
Loading…
Reference in a new issue