Module: Sniffer::Adapters::CurlAdapter
- Defined in:
- lib/sniffer/adapters/curb_adapter.rb
Overview
Curl adapter
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/sniffer/adapters/curb_adapter.rb', line 7 def self.included(base) base.class_eval do alias_method :http_without_sniffer, :http alias_method :http, :http_with_sniffer alias_method :http_post_without_sniffer, :http_post alias_method :http_post, :http_post_with_sniffer end end |
Instance Method Details
#http_post_with_sniffer(*args) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/sniffer/adapters/curb_adapter.rb', line 31 def http_post_with_sniffer(*args) sniffer_request(:POST, *args) bm = Benchmark.realtime do @res = http_post_without_sniffer(*args) end sniffer_response(bm) @res end |
#http_with_sniffer(verb) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sniffer/adapters/curb_adapter.rb', line 17 def http_with_sniffer(verb) sniffer_request(verb) http_without_sniffer(verb) bm = Benchmark.realtime do @res = http_without_sniffer(verb) end sniffer_response(bm) @res end |