簡體   English   中英

我們如何更改 firebase.functions().httpsCallable 中的 responseType

[英]how can we change responseType in firebase.functions().httpsCallable

最初我使用如下所示的 http post 方法生成 pdf

this.httpClient.post(this.globals.constUrl + 'reportData', data, {responseType: 'blob'})

通過訂閱響應訪問代碼

const myBlob: Blob = new Blob([res], {type: 'application/pdf;charset=utf-8'}); // replace the type by whatever type 

是你的回應

        const fileURL = URL.createObjectURL(myBlob);
        window.open(fileURL);

上面的代碼工作正常,但現在我想用 httpsCallable 完成它,在嘗試這個時我無法像在 post 方法中那樣更改 responseType,所以沒有生成 PDF 請建議一種方法來完成它。

可調用類型函數只能發送格式為 JSON 的數據。如果您需要發送不同的內容,則根本不應該使用可調用對象。 使用正常的HTTP 類型 function以獲得對響應的完全控制。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM