本文介绍了https.onCall从http调用访问req参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是以下功能 https://firebase.google.com/docs/functions/callable

语法是:-

exports.addMessage = functions.https.onCall((data, context) => {
  // ...
});

是否可以获取标准http函数中的req参数

Is there an option to get the req param we have in the standard http function

exports.date = functions.https.onRequest((req, res) => {
  // ...
});

req.protocol
req.get("host")

推荐答案

可调用对象不支持重定向.希望他们将直接响应发送给客户端(否则,它们将不会被调用").

Callables don't support redirects. They're expected to send direct responses to the client (otherwise, they wouldn't be "callable").

如果要向客户端发送重定向,请对可以遵循重定向(或自行处理重定向)的HTTP客户端使用常规HTTP触发器.

If you want to send a redirect to the client, use regular HTTP triggers with an HTTP client that can follow redirects (or handle the redirect yourself).

这篇关于https.onCall从http调用访问req参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 23:37