Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Let's not forget to send back the response even when called with a bl…

…ock.
  • Loading branch information...
commit 20363a2aa9c4b938486898dde54bb60855e3a3ce 1 parent 6bfb71c
@mathieuravaux mathieuravaux authored
Showing with 4 additions and 2 deletions.
  1. +1 −0  lib/em-net-http.rb
  2. +3 −2 spec/em-net-http_spec.rb
View
1  lib/em-net-http.rb
@@ -169,6 +169,7 @@ def request(req, body = nil, &block)
nhres.instance_variable_set :@httpreq, httpreq
yield nhres
+ nhres
else
httpreq.callback &convert_em_http_response
httpreq.errback {|err|f.resume(:error)}
View
5 spec/em-net-http_spec.rb
@@ -21,11 +21,12 @@
it 'should support buffering the response' do
assert_identical {
Net::HTTP.start('localhost', Mimic::MIMIC_DEFAULT_PORT) do |http|
- resp = http.request_get "/image" do |resp|
+ respone = http.request_get "/image" do |resp|
resp.should be_a_kind_of(Net::HTTPOK)
- resp.read_body
+ resp.read_body # force reading the body before the test tears down the EM loop
resp
end
+ respone.tap { respone.should be_a_kind_of(Net::HTTPOK) }
end
}
end
Please sign in to comment.
Something went wrong with that request. Please try again.