Skip to content

Commit

Permalink
add failing test from igrigorik/em-http-request#168 (now passing) /cc @…
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Feb 21, 2012
1 parent 3aebb7d commit d390219
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,24 @@
@parser.upgrade_data.should == ''
end

it "should execute on_body on requests with no content-length" do
@parser.reset!.should be_true

@head, @complete, @body = 0, 0, 0
@parser.on_headers_complete = proc {|h| @head += 1 }
@parser.on_message_complete = proc { @complete += 1 }
@parser.on_body = proc {|b| @body += 1 }

head_response = "HTTP/1.1 200 OK\r\n\r\nstuff"

@parser << head_response
@parser << ''
@head.should == 1
@complete.should == 1
@body.should == 1
end


%w[ request response ].each do |type|
JSON.parse(File.read(File.expand_path("../support/#{type}s.json", __FILE__))).each do |test|
test['headers'] ||= {}
Expand Down

1 comment on commit d390219

@igrigorik
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Will do some test runs on em-http with this, stay tuned.

Please sign in to comment.