Skip to content
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

Expose bluebird promises… #4

Merged
merged 2 commits into from
Mar 24, 2015
Merged

Conversation

tusbar
Copy link
Contributor

@tusbar tusbar commented Mar 24, 2015

… instead of httpinvoke’s homemade wrapper.

Feel free to merge, or not.
But https://github.com/request/request response objects are more common, so are Bluebird promises.

I removed the hook as I’m not sure that it does anything.

Expose real Promise API (Bluebird).
Full request requests and response are exposed in then/catch methods.
@moul
Copy link
Owner

moul commented Mar 24, 2015

Let's go :)

moul added a commit that referenced this pull request Mar 24, 2015
@moul moul merged commit 52f23df into moul:master Mar 24, 2015
@moul
Copy link
Owner

moul commented Mar 24, 2015

released at v0.3.0 on npm

@moul
Copy link
Owner

moul commented Mar 24, 2015

Promises are better, but we lose the normal callbacks
Is there a solution to keep promises and callbacks working together as did httpinvoke ? (cc @tusbar)

@tusbar
Copy link
Contributor Author

tusbar commented Mar 24, 2015

No no, nodejs callbacks still work fine as I’m using .nodeify().

var sdk = new (require('.'))();

sdk.get('/', function (err, res) {
    console.log(res.body);
});

See https://github.com/petkaantonov/bluebird/blob/master/API.md#nodeifyfunction-callback--object-options---promise

moul added a commit to scaleway/scaleway-cli that referenced this pull request Mar 24, 2015
moul added a commit that referenced this pull request Mar 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants