Class: Watchdocs::Rails::Middleware
- Includes:
- Helpers::BodyHelper, Helpers::QueryStringHelper
- Defined in:
- lib/watchdocs/rails/middleware.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Methods included from Helpers::QueryStringHelper
Methods included from Helpers::BodyHelper
#body_string, #log_and_return_empty, #parse_request_body, #parse_response_body
Constructor Details
permalink #initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
9 10 11 12 |
# File 'lib/watchdocs/rails/middleware.rb', line 9 def initialize(app) @app = app @report = {} end |
Instance Attribute Details
Instance Method Details
permalink #call(env) ⇒ Object
[View source]
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/watchdocs/rails/middleware.rb', line 14 def call(env) app.call(env).tap do |response| begin if json_response?(response) clear_report catch_request(env) catch_response(response) match_endpoint_pattern record_call end rescue StandardError => e $stderr.puts "Watchdocs Middleware Error: #{e.}" end end end |