lib/sniffer/adapters/curb_adapter.rb in sniffer-0.1.0 vs lib/sniffer/adapters/curb_adapter.rb in sniffer-0.2.0
- old
+ new
@@ -12,11 +12,10 @@
alias_method :http_post_without_sniffer, :http_post
alias_method :http_post, :http_post_with_sniffer
end
end
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def http_with_sniffer(verb)
sniffer_request(verb)
http_without_sniffer(verb)
@@ -45,10 +44,11 @@
def data_item
@data_item ||= Sniffer::DataItem.new if Sniffer.enabled?
end
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def sniffer_request(verb, *args)
return unless data_item
uri = URI(url)
query = uri.path
@@ -61,9 +61,10 @@
body: args.join("&"),
port: uri.port)
Sniffer.store(data_item)
end
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
def sniffer_response(timing)
return unless data_item
_, *http_headers = header_str.split(/[\r\n]+/).map(&:strip)