Closed JBX028 closed 11 years ago
You're using the parameters correctly, the problem is Wait.for is expecting standardized async with callback(err,data) as the last parameter, sou you must wrap request.get in order to standardize it:
//request.get standardized
request.standardGet = function ( options, callback) {
request.get(options,
function (error, response, body) {
//standardized callback
var data={ response: response, body:body};
callback(error,data);
});
}
...
// in a fiber
...
var data = wait.for( request.standardGet,
{ uri: 'https:blabla'
,headers: {'Authorization': 'Bearer ' + _BEARER}
});
output = JSON.parse(data.body)
return output.outcome.intent;
Note: Just writing it here - I did not try this code.
ok thanks ! :+1:
Hi,
How to use waitfor with the request module (https://github.com/mikeal/request):
How can I pass what is submitted to uri and header ? I tried this but without success...:
Thanks in advance for the help you can provide.