Sha256: 91cb5a8b18fe5fb446fa116016b74e954993297c8a64aa7f7ab72dbaec479dea

Contents?: true

Size: 728 Bytes

Versions: 7

Compression:

Stored size: 728 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, :port => 9901) do
      conn = EM::HttpRequest.new('http://localhost:9901')
      r1 = conn.get(:query => {:echo => 'test'}, :keepalive => true)

      r1.errback { fail }
      r1.callback do |c|
        b = MultiJson.load(c.response)
        b['response'].should == 'test'

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

          stop
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
goliath-1.0.5 spec/integration/keepalive_spec.rb
goliath-1.0.4 spec/integration/keepalive_spec.rb
goliath-1.0.3 spec/integration/keepalive_spec.rb
goliath-1.0.2 spec/integration/keepalive_spec.rb
goliath-1.0.1 spec/integration/keepalive_spec.rb
goliath-1.0.0 spec/integration/keepalive_spec.rb
goliath-1.0.0.beta.1 spec/integration/keepalive_spec.rb