Sha256: 781ead7422847c76cce888a72cf9f4f60652d3ba8169271a50bd4e7d9c8b2e3b

Contents?: true

Size: 738 Bytes

Versions: 2

Compression:

Stored size: 738 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)
        expect(b['response']).to eq('test')

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

          stop
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
goliath-1.0.7 spec/integration/keepalive_spec.rb
goliath-1.0.6 spec/integration/keepalive_spec.rb