lib/em-http/request.rb in julien51-em-http-request-0.1.9 vs lib/em-http/request.rb in julien51-em-http-request-0.1.10

- old
+ new

@@ -48,17 +48,18 @@ # host: String # Manually specify TCP connect host address, independent of # Host: header 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 host = options[:host] || @uri.host EventMachine.connect(host, @uri.port, EventMachine::HttpClient) { |c| c.uri = @uri @@ -67,10 +68,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