adding more methods necessary for the faraday adapter when it comes to multi-response errors

This commit is contained in:
HoneyryderChuck 2020-04-13 17:53:22 +01:00
parent cf5be6b899
commit 5823a040d0
2 changed files with 9 additions and 1 deletions

View File

@ -269,6 +269,14 @@ module HTTPX
@error.message
end
def reason
@error.class.name
end
def headers
{}
end
def body
@error.backtrace.join("\n")
end

View File

@ -18,7 +18,7 @@ class ErrorResponseTest < Minitest::Test
def test_respond_method_missing_errors
r1 = ErrorResponse.new(Minitest::Mock.new, RuntimeError.new("wow"), {})
ex1 = assert_raises(NoMethodError) { r1.headers }
ex1 = assert_raises(NoMethodError) { r1.read }
assert ex1.message =~ /undefined response method/
ex2 = assert_raises(NoMethodError) { r1.bang }
assert ex2.message =~ /undefined method/