Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #145 from subledger/accept_fixnum_status_codes
Browse files Browse the repository at this point in the history
connection#respond accepts Fixnum status
  • Loading branch information
tarcieri committed Apr 2, 2014
2 parents f444124 + 21dc455 commit dba5c52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/reel/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def respond(response, headers_or_body = {}, body = nil)
end

case response
when Symbol
when Symbol, Fixnum, Integer
response = Response.new(response, headers, body)
when Response
else raise TypeError, "invalid response: #{response.inspect}"
Expand Down
14 changes: 12 additions & 2 deletions spec/reel/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_chunked_response(request, client)
fixture = "5#{crlf}Hello#{crlf}5#{crlf}World#{crlf}0#{crlf*2}"
response[(response.length - fixture.length)..-1].should eq fixture
end

it "with keep-alive" do
with_socket_pair do |client, peer|
connection = Reel::Connection.new(peer)
Expand Down Expand Up @@ -141,7 +141,7 @@ def test_chunked_response(request, client)
end
end
end

it "reset the request after a response is sent" do
with_socket_pair do |client, peer|
connection = Reel::Connection.new(peer)
Expand Down Expand Up @@ -343,6 +343,16 @@ def test_chunked_response(request, client)
end
end

context "#respond" do
it "accepts Fixnum as status" do
with_socket_pair do |client, peer|
connection = Reel::Connection.new(peer)

connection.respond 200, {}, []
end
end
end

context "#each" do
it "streams request bodies" do
with_socket_pair do |client, peer|
Expand Down

0 comments on commit dba5c52

Please sign in to comment.