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.



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/appsignal/rack/body_wrapper.rb', line 112

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
  @transaction.set_error(error)
  raise error
end