Sha256: b313015c6b660a6e1e8daeaf764614b390649b712a49eaf490b130a5eb5746d3

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

require 'spec_helper'
require File.join(File.dirname(__FILE__), '../../', 'examples/echo')

describe 'HTTP Keep-Alive support' do
  it 'serves multiple requests via single connection' do
    with_api(Echo) do
      conn = EM::HttpRequest.new('http://localhost:9000')
      r1 = conn.get(:query => {:echo => 'test'}, :keepalive => true)

      r1.errback { fail }
      r1.callback do |c|
        b = Yajl::Parser.parse(c.response)
        b['response'].should == 'test'

        r2 = conn.get(:query => {:echo => 'test2'})
        r2.errback { fail }
        r2.callback do |c|
          b = Yajl::Parser.parse(c.response)
          b['response'].should == 'test2'

          stop
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
goliath-0.9.2 spec/integration/keepalive_spec.rb
goliath-0.9.1 spec/integration/keepalive_spec.rb