本文介绍了Firebase Cloud Functions https.onCall 完成状态码:204的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Firebase 函数
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const cors = require('cors')({ origin: true });
exports.addMessage = functions.https.onCall((data, context) => {
return { text: "Test" };
});
问题
问题是当我从应用程序调用此函数时,我首先得到完成状态码:204,然后完成状态码:200
The problem is when i call this function from the app i first get finished with status code: 204 and after that finished with status code: 200
如何防止这种情况发生?
How can i prevent this?
推荐答案
这是正常的,你不应该采取任何措施来阻止它.导致 204 的第一个请求是 CORS 执行 预检请求.200 是最终的服务请求.
You can read more about that here:
这篇关于Firebase Cloud Functions https.onCall 完成状态码:204的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!