question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Have denodeify() support multiple response parameters?

See original GitHub issue

I was currently about to wrap the request module with denodeify(), but the request() returns two parameters in its response and denodeify() only forwards the first parameter – therefore it doesn’t work.

Is there a reason for denodeify() to only return the first parameter? I think it could resolve the promise with them all in array if it finds that there are more than one response parameter.

That would make these two equal:

function callback (err, param1, param2) {
};
denodeify().then(function (result) {
  var param1 = result[0]
    , param2 = result[1];
});

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ForbesLindesaycommented, Jul 3, 2014

I’ve never needed it. In particular, the case of the request library is just down to poor docs on their part. You can access the body as res.body so the best thing to do is actually just to drop the third argument.

For cases where this is really needed, just fall back to new Promise.

0reactions
louwerscommented, Feb 7, 2015

I was not aware of that! Thank you.

Now I am using the denodify, package, which gives you even more customization settings on how to deal with multiple parameters.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sending multiple responses with Express.js per request
My problem (on step 4) is that I can't send two responses for the same request and I have this error message :...
Read more >
Allow for multiple response schemas for each response code
If the client is using the API properly, it should always have valid values for both, but it is unrealistic to state that...
Read more >
My five promise patterns - Remy Sharp
catch() is only in the ES6 spec and doesn't appear in Promises/A+ so some library implementations are missing .catch() support (as I've found ......
Read more >
25. Promises for asynchronous programming - Exploring JS
Promise.all() enables you to be notified once all results are in (a join in ... With Promises, function signatures become cleaner; all parameters...
Read more >
Express.js - Sending Multiple HTTP Responses - Blog
This function will receive two arguments: the request object and the response object. The response object has a send() method, an end() method...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found