Method: Rpruby::HttpClient#send_request
- Defined in:
- lib/rpruby/http_client.rb
#send_request(verb, path, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rpruby/http_client.rb', line 10 def send_request(verb, path, = {}) path.prepend("/api/v1/#{Settings.instance.project}/") path.prepend(origin) unless use_persistent? 3.times do begin response = @http.request(verb, path, ) rescue StandardError => e puts "Request #{request_info(verb, path)} produced an exception:" puts e recreate_client else return response.parse(:json) if response.status.success? = "Request #{request_info(verb, path)} returned code #{response.code}." << " Response:\n#{response}" unless response.to_s.empty? puts end end end |