Class: Appsignal::Rack::CallableBodyWrapper Private

Inherits:
BodyWrapper show all
Defined in:
lib/appsignal/rack/body_wrapper.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The callable response bodies are a new Rack 3.x feature, and would not work with older Rack versions. They must not respond to ‘each` because “If it responds to each, you must call each and not call”. This is why it inherits from BodyWrapper directly and not from EnumerableBodyWrapper

Constant Summary

Constants inherited from BodyWrapper

BodyWrapper::IGNORED_ERRORS

Instance Method Summary collapse

Methods inherited from BodyWrapper

#close, #initialize, #method_missing, #respond_to_missing?, wrap

Constructor Details

This class inherits a constructor from Appsignal::Rack::BodyWrapper

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Appsignal::Rack::BodyWrapper

Instance Method Details

#call(stream) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/appsignal/rack/body_wrapper.rb', line 125

def call(stream)
  # `stream` will be closed by the app we are calling, no need for us
  # to close it ourselves
  Appsignal.instrument("process_response_body.rack", "Process Rack response body (#call)") do
    @body.call(stream)
  end
rescue *IGNORED_ERRORS # Do not report
  raise
rescue Exception => error # rubocop:disable Lint/RescueException
  appsignal_report_error(error)
  raise error
end