是否可以在 `functions.https.onCall` Firebase API 中访问 `request` 和 `response` objects?

Is it possible to access the `request` and `response` objects in `functions.https.onCall` Firebase API?

我想访问 functions.https.onCall 中的 requestresponse objects。

我的用例是我想在响应中设置缓存 headers。

如果无法访问 headers,此 API 的用户如何为 CDN 和浏览器设置缓存?

对于 onCall 函数,您无法访问 request/response 对象。您可以通过检查 onCall types

来准确验证 onCall 函数接收到的内容

另一种方法是使用 functions.https.onRequest,但这具有安全隐患,使用 onRequest 发布的函数是开放的,因此您需要保护它们以防您访问敏感数据,幸好有 boiler plate project 说明了这一点。