Have denodeify() support multiple response parameters?
See original GitHub issueI 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:
- Created 9 years ago
- Comments:8 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
.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.