How to call Firebase Callable Functions with HTTP?

后端 未结 2 1213
清酒与你
清酒与你 2020-12-31 02:37

I realised that the new Callable Cloud Functions can still be called as if they were HTTP events, i.e. they can still be reached under http://us-central1-$projectname.

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-31 02:51

    EDIT: The details of the protocol have been formally documented now.

    HTTPS Callable functions must be called using the POST method, the Content-Type must be application/json or application/json; charset=utf-8, and the body must contain a field called data for the data to be passed to the method.

    Example body:

    {
        "data": {
            "aString": "some string",
            "anInt": 57,
            "aFloat": 1.23
        }
    }
    

    If you are calling a function by creating your own http request, you may find it more flexible to use a regular HTTPS function instead.

提交回复
热议问题