New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES6 Promise support #726
ES6 Promise support #726
Conversation
This addresses my compatibility concerns by adding a thenable fallback, but is weird/unexpected from a behavioral standpoint. Also, I'd suggest returning a promise from the |
I agree returning promise from I also think it should cache the promise, so that |
BTW: the code for both node and browser happens to be identical. Do you have a preferred way for sharing/reusing it? |
Yeah, which is further reason for var tmp = superagent.get().end();
tmp.then();
tmp.then(); |
I am gonna say it again. I do not care about supporting promises in this library. The Yes, we need to document the |
Since v1.1.0, SuperTest ships a version of SuperAgent with "thenable" support; that is, a then method which provides minimal interop with Promise libraries but does not provide full then semantics. See ladjs/superagent#722 and ladjs/superagent#726 for context. Since SuperTest's maintainer is entirely unwilling to support promises, we'll continue to maintain this library for those who want `.then()` to return a real promise.
What's the status please, there is an closed PR, but in the latest version of superagent (v1.4.0 and node v0.12.7) is not working as expected (see #722). |
@vire It was closed but not merged. @defunctzombie said above that he will not support A+ promises |
@FoxxMD thanks for clarification. It's a pity indeed to not be complaint with some standard approach. |
Superagent is not a promises implementation, though. Request objects just have a |
Here's a promise implementation (uses ES6/ES7 async/await too, with ES6's new |
Fixes #722