Would like to set up a HTTP trigger – Cloud Function that listens to a POST method and then Cloud Function will parse the payloads and make a post process on it.
- Would like to know what is the curl CLI I can use for testing the POST method with payloads? I used
curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" https://cf-scheduler-a.run.app/
but it does not include payloads. - For the HTTP payloads consumer function in cloud function side. It failed to get the payloads. Currently I use request.get_json function, is this the correct function I can use for getting the payloads from the curl POST CLI for testing purpose?
import functions_framework
from markupsafe import escape
def hello_http(request):
"""HTTP Cloud Function.
Args:
request (flask.Request): The request object.
<https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data>
Returns:
The response text, or any set of values that can be turned into a
Response object using `make_response`
<https://flask.palletsprojects.com/en/1.1.x/api/#flask.make_response>.
"""
request_json = request.get_json(silent=True)
return request_json
Thanks a lot!