lib/mistral_client/client.rb in mistral_client-1.2.1 vs lib/mistral_client/client.rb in mistral_client-1.3.0
- old
+ new
@@ -52,10 +52,11 @@
private
def post_or_put(verb, path, body, json)
raise ArgumentError unless %i[post put].include?(verb)
+
headers = if json
{ 'Content-Type' => 'application/json' }
else
{ 'Content-Type' => 'text/plain' }
end
@@ -68,9 +69,10 @@
def check_for_error(resp)
return if resp.code >= 200 && resp.code < 300
if resp.code == 404
raise MissingObjectError, JSON.parse(resp.body)['faultstring']
end
+
raise MistralResponseError.new(resp),
"Could not perform the requested operation:\n#{resp.body}"
end
end
end