Kong / unirest-nodejs

Unirest in Node.js: Simplified, lightweight HTTP client library.
http://unirest.io/nodejs
MIT License
949 stars 167 forks source link

Implement Promises and async/await #115

Closed charliemitchell closed 6 years ago

charliemitchell commented 6 years ago

This pull request allows using promises in unirest. By default, it also implements async/await.

The idea is that by defining then and returning a promise from it will also enable async/await.

Invoking then returns a proper promise chain with the callback try/catch wrapped so that errors that occur inside the callback can get handled by the catch method of the promise chain.

stoplion commented 3 years ago

How do you use async / await with this library? I've tried and it does not work