lib/preservation/client/versioned_api_service.rb in preservation-client-0.2.0 vs lib/preservation/client/versioned_api_service.rb in preservation-client-0.2.1
- old
+ new
@@ -18,10 +18,10 @@
resp = connection.get do |req|
req.url api_version.present? ? "#{api_version}/#{path}" : path
req.headers['Content-Type'] = 'application/json'
req.headers['Accept'] = 'application/json'
end
- return resp.body if resp.success?
+ return JSON.parse(resp.body).with_indifferent_access if resp.success?
errmsg = ResponseErrorFormatter
.format(response: resp, object_id: object_id, client_method_name: caller_method_name)
raise Preservation::Client::UnexpectedResponseError, errmsg
rescue Faraday::ResourceNotFound => e