lib/badgrcat/client.rb in bearcat-1.5.31 vs lib/badgrcat/client.rb in bearcat-1.5.32

- old
+ new

@@ -12,11 +12,11 @@ # Override Footrest request for ApiArray support def request(method, &block) response = begin connection.send(method, &block) - rescue Footrest::HttpError::NotFound => e + rescue Footrest::HttpError::BadRequest, Footrest::HttpError::NotFound => e raise e unless connection.headers[:authorization].nil? # Reauthenticate and retry if authorization header is nil authenticate! connection.send(method, &block) @@ -33,9 +33,14 @@ def request_with_params_in_body(method, path, options) request(method) do |r| r.path = fullpath(path) r.body = options.to_json unless options.empty? end + end + + # Modify delete request to send params in body instead of query params + def delete(path, options = {}) + request_with_params_in_body(:delete, path, options) end def authenticate! connection.headers[:authorization] = nil