class Patron::Session

Public Instance Methods

action_name,() click to toggle source

HttpLog.call(

url: url,
request_body: options[:data],
request_headers: headers,
response_code: @response.status,
response_body: @response.body,
response_headers: @response.headers,
benchmark: bm,
encoding: @response.headers['Content-Encoding'],
content_type: @response.headers['Content-Type']

)

# File lib/influxdb/rails/httplog/adapters/patron.rb, line 14
          
orig_request(action_name, url, headers, options = {})
Alias for: request
request(action_name, url, headers, options = {}) click to toggle source
# File lib/influxdb/rails/httplog/adapters/patron.rb, line 7
def request(action_name, url, headers, options = {})
  bm = Benchmark.realtime do
    @response = orig_request(action_name, url, headers, options)
  end

  if HttpLog.url_approved?(url)
    # HttpLog.call(
    #   method: action_name,
    #   url: url,
    #   request_body: options[:data],
    #   request_headers: headers,
    #   response_code: @response.status,
    #   response_body: @response.body,
    #   response_headers: @response.headers,
    #   benchmark: bm,
    #   encoding: @response.headers['Content-Encoding'],
    #   content_type: @response.headers['Content-Type']
    # )

    HttpLog.save_in_db(
        method: action_name,
        url: url,
        request_body: options[:data],
        request_headers: headers,
        response_code: @response.status,
        response_body: @response.body,
        response_headers: @response.headers,
        benchmark: bm,
        encoding: @response.headers['Content-Encoding'],
        content_type: @response.headers['Content-Type']
    )
  end

  @response
end
Also aliased as: orig_request