简体   繁体   English

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

[英]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.

相关问题 `httpsCallable` 与 `httpsCallableFromURL` 可调用 Firebase 函数 - `httpsCallable` vs. `httpsCallableFromURL` callable Firebase Functions 如何将 Firebase Functions v8 添加到 Swift iOS 项目并在 httpsCallable 中使用 Codable? - How to add Firebase Functions v8 to a Swift iOS project and use Codable in httpsCallable? 我们如何解决 flutter 应用程序中的 firebase 函数内部异常? - How can we resolve firebase functions INTERNAL exception in a flutter app? Flutter Firebase 使用 httpsCallable 删除 function - Flutter Firebase delete function with httpsCallable 我们不能在 Firebase Cloud Functions 中写入多个文件吗 - Can't we Write multiple files in Firebase Cloud Functions 快速解码 httpsCallable 云函数响应 - Swift decode httpsCallable cloud functions response Firebase + Nuxt SSR - httpsCallable 错误“未定义标头” - Firebase + Nuxt SSR - httpsCallable error "Headers is not defined" 是否可以为 httpsCallable 函数指定输入和返回类型? - Is it possible to specify input and return types for httpsCallable functions? 我们如何在 ios swift 上对 firebase / firestore 查询进行分页? - How can we paginate a firebase / firestore query on ios swift? 我们如何在 Swift 中使用 firebase 发送位置消息 - How we can send the location messages using firebase in Swift
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM