Parent

Sinatra::Async::Test::AsyncSession

Public Instance Methods

handle_last_response(uri, env, status, headers, body) click to toggle source
# File lib/sinatra/async/test.rb, line 40
def handle_last_response(uri, env, status, headers, body)
  @last_response = Rack::MockResponse.new(status, headers, body, env["rack.errors"].flush)
  body.close if body.respond_to?(:close)

  cookie_jar.merge(last_response.headers["Set-Cookie"], uri)

  @after_request.each { |hook| hook.call }
  @last_response
end
request(uri, env) click to toggle source
# File lib/sinatra/async/test.rb, line 33
def request(uri, env)
  env['async.callback'] = lambda { |r| s,h,b = *r; handle_last_response(uri, env, s,h,b) }
  env['async.close'] = AsyncCloser.new
  catch(:async) { super }
  @last_response ||= Rack::MockResponse.new(-1, {}, [], env["rack.errors"].flush)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.