Class: Sinatra::ExtendedRack

Inherits:
Struct show all
Defined in:
lib/vendor/sinatra-1.4.4/lib/sinatra/base.rb

Overview

Some Rack handlers (Thin, Rainbows!) implement an extended body object protocol, however, some middleware (namely Rack::Lint) will break it by not mirroring the methods in question. This middleware will detect an extended body object and will make sure it reaches the handler directly. We do this here, so our middleware and middleware set up by the app will still be able to run.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#to_h

Instance Attribute Details

#appObject

Returns the value of attribute app

Returns:

  • (Object)

    the current value of app



178
179
180
# File 'lib/vendor/sinatra-1.4.4/lib/sinatra/base.rb', line 178

def app
  @app
end

Instance Method Details

#call(env) ⇒ Object



179
180
181
182
183
184
185
# File 'lib/vendor/sinatra-1.4.4/lib/sinatra/base.rb', line 179

def call(env)
  result, callback = app.call(env), env['async.callback']
  return result unless callback and async?(*result)
  after_response { callback.call result }
  setup_close(env, *result)
  throw :async
end