Sha256: 9b7b26ba3b5e3b76a2a39f8f7cea272727d8f2f576f0faa4eca236f19311d204

Contents?: true

Size: 997 Bytes

Versions: 1

Compression:

Stored size: 997 Bytes

Contents

EventMachine based HTTP Request interface. Supports streaming response processing / based on Zed Shaw's Ragel HTTP parser. 
 - Borrows a lot of good concepts from Rev's HttpClient, Curb, and other libraries.
 - Offers support for single or parallel request queries & via deferred callbacks

Simple client example: 
--------

EventMachine.run {
  http = EventMachine::HttpRequest.new('http://127.0.0.1/').get :query => {'keyname' => 'value'}
 
  http.callback {
    p http.response_header.status
    p http.response_header
    p http.response
    
    EventMachine.stop
  }
}

Multi request example:
----------

EventMachine.run {
  multi = EventMachine::MultiRequest.new
      
  # add multiple requests to the multi-handler
  multi.add(EventMachine::HttpRequest.new('http://www.google.com/').get)
  multi.add(EventMachine::HttpRequest.new('http://www.yahoo.com/').get)
      
  multi.callback  {
    p multi.responses[:succeeded]
    p multi.responses[:failed]
       
    EventMachine.stop
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tmm1-em-http-request-0.1.0 README