class HTTPClient

Private Instance Methods

do_get_block(req, proxy, conn, &block) click to toggle source
# File lib/influxdb/rails/httplog/adapters/httpclient.rb, line 9
def do_get_block(req, proxy, conn, &block)
  retryable_response = nil
  bm = Benchmark.realtime do
    begin
      orig_do_get_block(req, proxy, conn, &block)
    rescue RetryableResponse => e
      retryable_response = e
    end
  end

  if HttpLog.url_approved?(req.header.request_uri)
    res = conn.pop

    # HttpLog.call(
    #   method: req.header.request_method,
    #   url: req.header.request_uri,
    #   request_body: req.body,
    #   request_headers: req.headers,
    #   response_code: res.status_code,
    #   response_body: res.body,
    #   response_headers: res.headers,
    #   benchmark: bm,
    #   encoding: res.headers['Content-Encoding'],
    #   content_type: res.headers['Content-Type']
    # )

    HttpLog.save_in_db(
        method: req.header.request_method,
        url: req.header.request_uri,
        request_body: req.body,
        request_headers: req.headers,
        response_code: res.status_code,
        response_body: res.body,
        response_headers: res.headers,
        benchmark: bm,
        encoding: res.headers['Content-Encoding'],
        content_type: res.headers['Content-Type']
    )
    conn.push(res)
  end

  raise retryable_response unless retryable_response.nil?
end
Also aliased as: orig_do_get_block
orig_do_get_block(req, proxy, conn, &block)
Alias for: do_get_block
req.header.request_method,() click to toggle source

HttpLog.call(

url: req.header.request_uri,
request_body: req.body,
request_headers: req.headers,
response_code: res.status_code,
response_body: res.body,
response_headers: res.headers,
benchmark: bm,
encoding: res.headers['Content-Encoding'],
content_type: res.headers['Content-Type']

)

# File lib/influxdb/rails/httplog/adapters/httpclient.rb, line 23