Class: Sinatra::ExtendedRack

Inherits:
Struct
  • Object
show all
Defined in:
lib/sinatra/base.rb

Overview

Some Rack handlers (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

Instance Attribute Details

#appObject

Returns the value of attribute app

Returns:

  • (Object)

    the current value of app


217
218
219
# File 'lib/sinatra/base.rb', line 217

def app
  @app
end

Instance Method Details

#call(env) ⇒ Object


218
219
220
221
222
223
224
225
226
# File 'lib/sinatra/base.rb', line 218

def call(env)
  result = app.call(env)
  callback = env['async.callback']
  return result unless callback && async?(*result)

  after_response { callback.call result }
  setup_close(env, *result)
  throw :async
end