是否可以从firebase云功能http触发器中获取api并从中获取响应?
如果是,请提供任何示例代码。
这是我尝试的代码:
exports.date = functions.https.onRequest((req, res) => {
const curl = new (require( 'curl-request' ))();
curl.setHeaders(['Authorization: Bearer '])
.get('url which i want to hit (api url)')
.then(({statusCode, body, headers}) => {
console.log(statusCode, body, headers)
})
.catch((e) => {
console.log(e);
});
});