Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tmm1-em-http-request

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tmm1-em-http-request

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= EM-HTTP-Client

EventMachine based HTTP Request interface. Supports streaming response processing, uses Ragel HTTP parser.

  • Simple interface for single & parallel requests via deferred callbacks
  • Automatic gzip & deflate decoding
  • Basic-Auth support

== 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
}

}

== Basic-Auth example

EventMachine.run { http = EventMachine::HttpRequest.new('http://www.website.com/').get :head => {'authorization' => ['user', 'pass']}

http.errback { failed }
http.callback {
  p http.response_header

  EventMachine.stop
}

}

FAQs

Package last updated on 10 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc