superagent
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
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')