Skip to content

Commit a3be8a2

Browse files
author
Peter Plant
committed
added a check if response_body is a String
1 parent b8b204c commit a3be8a2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/adyen/client.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ def call_adyen_api(service, action, request_data, headers, version, _with_applic
153153
faraday.headers['Content-Type'] = 'application/json'
154154
faraday.headers['User-Agent'] = "#{Adyen::NAME}/#{Adyen::VERSION}"
155155

156-
faraday.response :json
157-
158156
# set header based on auth_type and service
159157
auth_header(auth_type, faraday)
160158

@@ -374,6 +372,7 @@ def build_error_message(response_body, default_message)
374372
full_message = default_message
375373
begin
376374
error_details = response_body
375+
error_details = JSON.parse(response_body, symbolize_names: true) if response_body.is_a?(String)
377376

378377
# check different attributes to support both RFC 7807 and legacy models
379378
message = error_details[:detail] || error_details[:message]

0 commit comments

Comments
 (0)