lib/em-http/request.rb in igrigorik-em-http-request-0.1.7 vs lib/em-http/request.rb in igrigorik-em-http-request-0.1.8

- old
+ new

@@ -45,17 +45,18 @@ # Called for each response body chunk (you may assume HTTP 200 # OK then) # def get options = {}; send_request(:get, options); end + def head options = {}; send_request(:head, options); end def post options = {}; send_request(:post, options); end protected def send_request(method, options) raise ArgumentError, "invalid request path" unless /^\// === @uri.path - + method = method.to_s.upcase begin EventMachine.connect(@uri.host, @uri.port, EventMachine::HttpClient) { |c| c.uri = @uri c.method = method @@ -63,10 +64,10 @@ c.comm_inactivity_timeout = options[:timeout] || 5 } rescue RuntimeError => e raise e unless e.message == "no connection" conn = EventMachine::HttpClient.new("") - conn.on_error("no connection") + conn.on_error("no connection", true) conn end end end end