Class: Patron::Session
- Inherits:
-
Object
- Object
- Patron::Session
- Defined in:
- lib/influxdb/rails/httplog/adapters/patron.rb
Instance Method Summary collapse
Instance Method Details
#orig_request ⇒ Object
6 |
# File 'lib/influxdb/rails/httplog/adapters/patron.rb', line 6 alias orig_request request |
#request(action_name, url, headers, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/influxdb/rails/httplog/adapters/patron.rb', line 7 def request(action_name, url, headers, = {}) bm = Benchmark.realtime do @response = orig_request(action_name, url, headers, ) 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: [: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 |