Sha256: bce334cb5f2850ef4dea85f2d2a58e0d6f99cac31de152224f08fb08e992fdf7

Contents?: true

Size: 880 Bytes

Versions: 5

Compression:

Stored size: 880 Bytes

Contents

require 'spec_helper'
require File.join(File.dirname(__FILE__), '../../', 'lib/goliath/test_helper_streaming')
require File.join(File.dirname(__FILE__), '../../', 'lib/goliath')

class ChunkedStreaming < Goliath::API

  def response(env)

    EM.next_tick do
      env.chunked_stream_send("chunked")
      env.chunked_stream_close
    end

    headers = { 'Content-Type' => 'text/plain', 'X-Stream' => 'Goliath' }
    chunked_streaming_response(200, headers)
  end

  def on_close(env)
  end
end

describe "ChunkedStreaming" do
  include Goliath::TestHelper

  let(:err) { Proc.new { |c| fail "HTTP Request failed #{c.response}" } }

  it "should stream content" do
    with_api(ChunkedStreaming, {:verbose => true, :log_stdout => true}) do |server|
      streaming_client_connect('/streaming') do |client|
        client.receive.should == "chunked"
      end
    end
  end
end


Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
goliath-1.0.5 spec/integration/chunked_streaming_spec.rb
goliath-1.0.4 spec/integration/chunked_streaming_spec.rb
goliath-1.0.3 spec/integration/chunked_streaming_spec.rb
goliath-1.0.2 spec/integration/chunked_streaming_spec.rb
goliath-1.0.1 spec/integration/chunked_streaming_spec.rb