lib/sniffer.rb in sniffer-0.3.2 vs lib/sniffer.rb in sniffer-0.4.0
- old
+ new
@@ -46,14 +46,23 @@
def data
@data ||= Sniffer::Data.new
end
def store(data_item)
- data.store(data_item) if config.store
+ return unless config.store
+ return unless data_item.allowed_to_sniff?
+
+ config.middleware.invoke_request(data_item) do
+ data.store(data_item)
+ end
end
- def logger
- config.logger
+ def notify_response(data_item)
+ return unless config.store
+ return unless data_item.allowed_to_sniff?
+
+ config.middleware.invoke_response(data_item) do
+ end
end
end
end
require_relative "sniffer/adapters/net_http_adapter"