lib/resend/request.rb in resend-0.4.0 vs lib/resend/request.rb in resend-0.5.0
- old
+ new
@@ -29,13 +29,14 @@
# Performs the HTTP call
def perform
options = {
headers: @headers
}
+
options[:body] = @body.to_json unless @body.empty?
resp = HTTParty.send(@verb.to_sym, "#{BASE_URL}#{@path}", options)
resp.transform_keys!(&:to_sym) unless resp.body.empty?
- handle_error!(resp) if resp[:statusCode] && resp[:statusCode] != 200
+ handle_error!(resp) if resp[:statusCode] && (resp[:statusCode] != 200 || resp[:statusCode] != 201)
resp
end
def handle_error!(resp)
code = resp[:statusCode]