[英]how can we change responseType in firebase.functions().httpsCallable
Initially i was using http post method like below to generate pdf最初我使用如下所示的 http post 方法生成 pdf
this.httpClient.post(this.globals.constUrl + 'reportData', data, {responseType: 'blob'})
access code with subscribe the response通过订阅响应访问代码
const myBlob: Blob = new Blob([res], {type: 'application/pdf;charset=utf-8'}); // replace the type by whatever type
is your response是你的回应
const fileURL = URL.createObjectURL(myBlob);
window.open(fileURL);
The above code is working fine but now i want to get it done with httpsCallable, while attempting this I am not able to change responseType as we do in post method, so PDF is not being generated Please suggest a way to get it done.上面的代码工作正常,但现在我想用 httpsCallable 完成它,在尝试这个时我无法像在 post 方法中那样更改 responseType,所以没有生成 PDF 请建议一种方法来完成它。
Callable type functions can only send data formatted as JSON. If you need to send something different, you shouldn't use a callable at all.可调用类型函数只能发送格式为 JSON 的数据。如果您需要发送不同的内容,则根本不应该使用可调用对象。 Use a normal HTTP type function to gain full control over the response.
使用正常的HTTP 类型 function以获得对响应的完全控制。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.