![](/img/trans.png)
[英]How to test `functions.https.onCall` firebase cloud functions locally?
[英]How can `firebase.functions().httpsCallable` submit files to `functions.https.onCall`?
背景:
規格:
firebase.functions().httpsCallable
從前端調用 Cloud Functionsfunctions.https.onCall
問題:
firebase.functions().httpsCallable
如何將文件提交到functions.https.onCall
?
先感謝您。
ABC。
這並不是可調用函數的真正預期用例。 Callables 旨在將 JSON 有效負載發送到服務器,而不是文件。 如果您真的想將(小)文件發送到函數,則需要將其進行 base64 編碼為字符串,並將該字符串放入 JSON 有效負載中,然后在函數中對其進行解碼。
相反,請考慮允許客戶端直接上傳到存儲,然后使用一個函數通過存儲觸發器對其進行驗證,如果無效則將其刪除。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.