lib/tracker_api/client.rb in tracker_api-0.2.7 vs lib/tracker_api/client.rb in tracker_api-0.2.8

- old
+ new

@@ -184,9 +184,16 @@ url = options.fetch(:url) params = options[:params] || {} body = options[:body] headers = options[:headers] + if (method == :post || method == :put) && options[:body].blank? + body = params.to_json + headers['Content-Type'] = 'application/json' + + params = {} + end + @last_response = response = connection.send(method) do |req| req.url(url) req.headers.merge!(headers) req.params.merge!(params) req.body = body