class Fluoride::Collector::Middleware::CollectExchanges
Public Instance Methods
call(env)
click to toggle source
# File lib/fluoride-collector/middleware/collect-exchanges.rb, line 6 def call(env) @app.call(env).tap do |response| store( clean_hash( "type" => "normal_exchange", "tags" => @tagging, "request" => request_hash(env), "response" => response_hash(response) )) end end
Private Instance Methods
collection_type()
click to toggle source
# File lib/fluoride-collector/middleware/collect-exchanges.rb, line 19 def collection_type :exchange end
extract_body(body)
click to toggle source
# File lib/fluoride-collector/middleware/collect-exchanges.rb, line 23 def extract_body(body) array = [] body.each do |chunk| array << chunk end body.rewind if body.respond_to?(:rewind) array end
response_hash(response)
click to toggle source
# File lib/fluoride-collector/middleware/collect-exchanges.rb, line 32 def response_hash(response) status, headers, body = *response { "status" => status, "headers" => headers.to_hash, "body" => extract_body(body) } end