Class: Immunio::BodyWrapper
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Immunio::BodyWrapper
- Defined in:
- lib/immunio/plugins/http_finisher.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(body) ⇒ BodyWrapper
constructor
A new instance of BodyWrapper.
- #respond_to?(*args) ⇒ Boolean
Constructor Details
#initialize(body) ⇒ BodyWrapper
Returns a new instance of BodyWrapper.
22 23 24 25 |
# File 'lib/immunio/plugins/http_finisher.rb', line 22 def initialize(body) super body @body = body end |
Instance Method Details
#each ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/immunio/plugins/http_finisher.rb', line 27 def each begin @body.each do |chunk| Immunio.run_hook "http_finisher", "http_response_body_chunk", chunk: chunk yield chunk end rescue RequestBlocked # We need to catch this exception here as access to static files is # deferred. If one of our hooks, such as file_io throws when the Rake # stack has unwound this far it will kill the request with a 500 yield "Request Blocked" end Immunio.run_hook "http_finisher", "http_request_finish" # Reset current request Immunio.finish_request end |
#respond_to?(*args) ⇒ Boolean
46 47 48 |
# File 'lib/immunio/plugins/http_finisher.rb', line 46 def respond_to?(*args) @body.respond_to?(*args) end |