lib/trav3/response/response.rb in trav3-0.3.0 vs lib/trav3/response/response.rb in trav3-0.3.1
- old
+ new
@@ -14,10 +14,10 @@
:initialize_http_header, :get_fields, :each_header
def initialize(travis, response)
@travis = travis
@response = response
@collection = begin
- result = JSON.parse(response.body)
+ result = JSON.parse(response&.body || '{}')
ResponseCollection.new(travis, result)
rescue JSON::ParserError
response.error!
end
end