# 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
# 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