Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/aliyunsdkcore/roa_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def request(method:, uri:, params: {}, body: {}, headers: {}, options: {})
response_content_type = response.headers['Content-Type'] || ''
if response_content_type.start_with?('application/json')
if response.status >= 400
result = JSON.parse(response.body)
raise StandardError, "code: #{response.status}, #{result['Message']} requestid: #{result['RequestId']}"
result = JSON.parse(response.body).transform_keys(&:downcase)
raise StandardError, "status: #{response.status}, code: #{result['code']}, message: #{result['message']}, requestid: #{result['requestid']}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/roa_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
.to_return(status: status, headers: headers, body: body)
expect {
roa_client.get(uri: '/', headers: { 'content-type': 'application/json' })
}.to raise_error(StandardError, 'code: 400, error message requestid: requestid')
}.to raise_error(StandardError, 'status: 400, code: errorcode, message: error message, requestid: requestid')
end
end

Expand Down