when I use Promise.spread(), I got this err.
Here is my code:
Promise = require 'bluebird'
request = Promise.promisifyAll(require 'request')
request.postAsync(options)
.spread (resp, body) ->
console.log "resp----->",resp
console.log "body----->",body
.catch (err) ->
console.log err
It goes to catch and console log err.If I use .then ,it works well.
I can get the 'resp' and 'body' in a list[].
Then I change my code to this:
request.post options, (err,resp,body)->
if err
console.log err
console.log "body--------->",body
It works well too.
But I remember I have used .spread and get the right result.
$ npm list bluebird
[email protected]
$ npm list request
[email protected]
I turn to [email protected], the .spread works well.
Did I miss somthing?
{multiArgs: true} as the second parameter to promisifyAll or not using .spread and using then.
Bluebird does not promisify with arrays by default anymore - it does with the first parameter.
@benjamingr Thanks.
Most helpful comment
{multiArgs: true}as the second parameter to promisifyAll or not using.spreadand usingthen.Bluebird does not promisify with arrays by default anymore - it does with the first parameter.