且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

zappier代码中的基本HTTP身份验证

更新时间:2023-12-02 20:56:04

事实证明,回调函数的第一个参数始终是错误的,因此,如果我们从异步操作中获得某些结果,我们应该将null作为第一个参数传递给callback,例如就我而言,我应该有这个:

It turns out that the first argument of callback function is always error, thus if we have the some result to pass from asynchronous action we should pass null as the first argument to callback, e.g. in my case I should have this:

fetch(settings.url, settings)
.then(function (r) {
  callback(null, {data: r});
}).catch(callback);