mirror of
https://github.com/rest-client/rest-client.git
synced 2022-11-09 13:49:40 -05:00
better warning message
This commit is contained in:
parent
6860a4ee35
commit
72673af123
1 changed files with 4 additions and 2 deletions
|
@ -6,6 +6,8 @@ module RestClient
|
|||
|
||||
attr_reader :body
|
||||
|
||||
WARNING_MESSAGE = '[warning] The Response is no more a String and the Response content is now accessed through Response.body, please update your code'
|
||||
|
||||
def initialize body, net_http_res, args
|
||||
super net_http_res, args
|
||||
@body = body || ""
|
||||
|
@ -13,7 +15,7 @@ module RestClient
|
|||
|
||||
def method_missing symbol, *args
|
||||
if body.respond_to? symbol
|
||||
warn "[warning] The Response is no more a String, please update your code"
|
||||
warn WARNING_MESSAGE
|
||||
body.send symbol, *args
|
||||
else
|
||||
super
|
||||
|
@ -26,7 +28,7 @@ module RestClient
|
|||
else
|
||||
equal_body = (body == o)
|
||||
if equal_body
|
||||
warn "[warning] The Response is no more a String, please update your code"
|
||||
warn WARNING_MESSAGE
|
||||
end
|
||||
equal_body
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue