[英]Firebase Cloud Functions https.onCall finished with status code: 204
Firebase Function 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" };
});
Issue 问题
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 问题是当我从应用程序调用此函数时,我首先完成状态代码:204 ,然后完成状态代码:200
How can i prevent this? 我该如何防止这种情况?
This is normal, and you shouldn't do anything to prevent it. 这是正常的,你不应该做任何事情来阻止它。 The first request that results in 204 is what happens when CORS performs a preflight request . 导致204的第一个请求是CORS执行预检请求时发生的情况。 The 200 is the final serviced request. 200是最终的服务请求。
You can read more about that here: 你可以在这里阅读更多相关信息:
Two calls on Post request: with http 204 and 200 对Post请求进行两次调用:使用http 204和200
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.