Sha256: 199a86b5c7fcb95fb1ecf9d4f5b7e42c3d07133f6d568e6c8d636e228a8a963c

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

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

describe 'HTTP Keep-Alive support' do
  include Goliath::TestHelper

  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

1 entries across 1 versions & 1 rubygems

Version Path
goliath-0.9.0 spec/integration/keepalive_spec.rb