Skip to content


MIT 176 16 16,536
40.3 million (month) Aug 22 2011 8.1.2(7 months ago)
1,218 4 18 MIT
1.1.7(3 years ago) Oct 25 2009 247.3 thousand (month)

superagent is an HTTP client library for Node.js that provides a simple, flexible, and powerful API for making HTTP requests. It supports all major HTTP methods, and has a clean and easy-to-use interface for handling responses and errors.

what differentiates superagent from other http clients is its simple declarative API.

em-http-request is a Ruby gem for making asynchronous HTTP requests using EventMachine. It allows you to perform multiple requests simultaneously and handle the responses as they come in, rather than waiting for each request to complete before making the next one.

In short it supports: - Asynchronous HTTP API for single & parallel request execution - Keep-Alive and HTTP pipelining support - Auto-follow 3xx redirects with max depth - Automatic gzip & deflate decoding - Streaming response processing - Streaming file uploads - HTTP proxy and SOCKS5 support - Basic Auth & OAuth - Connection-level & global middleware support - HTTP parser via http_parser.rb - Works wherever EventMachine runs: Rubinius, JRuby, MRI



Example Use

const superagent = require('superagent');

// superagent supports both Promises and async/await
    .then(res => console.log(res.text))
    .catch(err => console.error(err));
const response = superagent.get('')

// post requests:'').send({ name: 'John Doe' })

// setting proxy

// settings headers and proxies
superagent.get('').set('Cookie', 'myCookie=123').set('X-My-Header', 'myValue') {
  http ='').get :query => {'keyname' => 'value'}

  # add callback for errors:
  http.errback { p 'Uh oh'; EM.stop }

  # add callback for successful requests
  http.callback {
    p http.response_header.status
    p http.response_header
    p http.response


Alternatives / Similar