lib/em-http/request.rb in igrigorik-em-http-request-0.1.3 vs lib/em-http/request.rb in igrigorik-em-http-request-0.1.5

- old
+ new

@@ -25,11 +25,11 @@ class HttpRequest def initialize(host, headers = {}) @headers = headers - @uri = URI::parse(host) + @uri = URI::parse(host) unless host.kind_of? URI end # Send an HTTP request and consume the response. Supported options: # # head: {Key: Value} @@ -39,10 +39,14 @@ # Specify query string parameters (auto-escaped) # # body: String # Specify the request body (you must encode it for now) # + # on_response: Proc + # Called for each response body chunk (you may assume HTTP 200 + # OK then) + # def get options = {}; send_request(:get, options); end def post options = {}; send_request(:post, options); end protected @@ -64,6 +68,6 @@ conn.on_error("no connection") conn end end end -end \ No newline at end of file +end