class Stackify::HttpClient

Constants

HEADERS

Attributes

errors[R]
response[R]

Private Instance Methods

send_request(uri, body, headers = HEADERS) click to toggle source
# File lib/stackify/http_client.rb, line 16
def send_request uri, body, headers = HEADERS
  @errors = []
  begin
    conn = Faraday.new(proxy: Stackify.configuration.proxy)
    Stackify.internal_log :debug, "============Request body=========================="
    Stackify.internal_log :debug, body
    Stackify.internal_log :debug, "=================================================="
    @response = conn.post do |req|
                  req.url URI(uri)
                  req.headers = headers
                  req.body = body
                end
  return @response
  rescue => ex
    @errors << ex
    Stackify.log_internal_error('HttpClient: ' + ex.message+ ' Backtrace: '+ Stackify::Backtrace.backtrace_in_line(ex.backtrace))
    false
  end
end