Class: LogStruct::Integrations::HostAuthorization::ResponseApp
- Inherits:
-
Object
- Object
- LogStruct::Integrations::HostAuthorization::ResponseApp
- Extended by:
- T::Sig
- Defined in:
- lib/log_struct/integrations/host_authorization.rb
Overview
Logs the blocked host, then responds with the app's own response_app if it set one
Instance Attribute Summary collapse
- #app_response_app ⇒ T.untyped readonly
Instance Method Summary collapse
Constructor Details
#initialize(app_response_app) ⇒ void
61 62 63 |
# File 'lib/log_struct/integrations/host_authorization.rb', line 61 def initialize(app_response_app) @app_response_app = app_response_app end |
Instance Attribute Details
#app_response_app ⇒ T.untyped (readonly)
58 59 60 |
# File 'lib/log_struct/integrations/host_authorization.rb', line 58 def app_response_app @app_response_app end |
Instance Method Details
#call(env) ⇒ T.untyped
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/log_struct/integrations/host_authorization.rb', line 66 def call(env) begin log_blocked_host(env) rescue => e LogStruct.handle_exception(e, source: LogStruct::Source::Internal, context: {integration: :host_authorization}) end return @app_response_app.call(env) if @app_response_app # Dup the headers so they can be modified by downstream middleware [FORBIDDEN_STATUS, RESPONSE_HEADERS.dup, [RESPONSE_HTML]] end |