@@ -3,11 +3,19 @@ module Aviator
|
|||||||
class Response
|
class Response
|
||||||
|
|
||||||
|
|
||||||
|
def body
|
||||||
|
@body ||= if response.body.length > 0
|
||||||
|
JSON.parse(response.body).with_indifferent_access
|
||||||
|
else
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
|
||||||
|
@body.dup
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def method_missing(name, *args)
|
def method_missing(name, *args)
|
||||||
case name
|
case name
|
||||||
when :body
|
|
||||||
@body ||= JSON.parse(response.body).with_indifferent_access
|
|
||||||
@body.dup
|
|
||||||
when :headers, :status
|
when :headers, :status
|
||||||
response.send(name)
|
response.send(name)
|
||||||
when :request
|
when :request
|
||||||
|
Reference in New Issue
Block a user