lib/watchdocs/rails/middleware.rb in watchdocs-rails-0.1.3 vs lib/watchdocs/rails/middleware.rb in watchdocs-rails-0.1.4
- old
+ new
@@ -9,10 +9,11 @@
end
def call(env)
app.call(env).tap do |response|
if json_response?(response)
+ clear_report
catch_request(env)
catch_response(response)
match_endpoint_pattern
record_call
end
@@ -22,9 +23,13 @@
private
def json_response?(response)
headers = response.second
headers['Content-Type'] && headers['Content-Type'].include?('json')
+ end
+
+ def clear_report
+ @report = {}
end
def catch_request(env)
@report[:request] = {
method: env['REQUEST_METHOD'],