Skip to content

wreckvssuperagent

BSD-3-Clause 4 7 378
300.2 thousand (month) Aug 06 2011 18.1.0(2025-07-24 23:01:15 ago)
16,610 16 180 MIT
Aug 22 2011 41.1 million (month) 10.1.1(2024-10-22 17:26:05 ago)

Wreck is an HTTP client library for Node.js. It provides a simple, consistent API for making HTTP requests, including support for both the client and server side of an HTTP transaction.

Wreck is a very minimal but stable as it's part of Hapi web framework project. For web scraping, it doesn't offer required features like proxy configuration or http2 support so it's not recommended.

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.

Highlights


declarativeproxypopular

Example Use


```javascript const Wreck = require('wreck'); // get request Wreck.get('http://example.com', (err, res, payload) => { if (err) { throw err; } console.log(payload.toString()); }); // post request const options = { headers: { 'content-type': 'application/json' }, payload: JSON.stringify({ name: 'John Doe' }) }; Wreck.post('http://example.com', options, (err, res, payload) => { if (err) { throw err; } console.log(payload.toString()); }); ```
```javascript const superagent = require('superagent'); // superagent supports both Promises and async/await superagent.get('https://httpbin.org/get') .then(res => console.log(res.text)) .catch(err => console.error(err)); const response = superagent.get('https://httpbin.org/get') // post requests: superagent.post('https://httpbin.org/post').send({ name: 'John Doe' }) // setting proxy superagent.get('https://httpbin.org/ip').proxy('http://proxy.example.com:8080') // settings headers and proxies superagent.get('https://httpbin.org/headers').set('Cookie', 'myCookie=123').set('X-My-Header', 'myValue') ```

Alternatives / Similar


Was this page helpful?