Closed nareshbhatia closed 8 years ago
Had you tried that you'd see that it doesn't actually work. Promisifying the request object would give you a few functions, like getAsync(url, query)
, postAsync(url, body)
, etc.. but not functionality like request.get(url).set(headers).endAsync()
or cancelable promises.
Since I posted this issue, I went ahead and tried promisifying superagent directly. The following is working without any issues:
return request
.get(url)
.set('authorization', authHeader)
.endAsync()
.then(function(res) {
return res.body;
});
So I am still not clear as to what superagent-bluebird-promise will buy me. BTW, I don't have a use case for cancelable promises.
Cancellable request promises was the main reason I started using this library, which wouldn't work with your snippet. Closing this as it's not actually an issue with the library.
I just came across this library. From the README.md, it was not clear to me what would be the advantages of using it over promisifying the superagent library directly:
The only difference I can see is that I would have to use request.endSync() to get a promise back, which is not a great justification for adding one more dependency to my projects. Am I missing something really obvious?