I have a simple Google Cloud Run function in Python. It uses Flask to take a JSON request and return a JSON response.
The function works fine, but I'd like to be able to trigger it easily through the Google Cloud Console web interface.
When I click on "Test" for the function, the "Configure triggering event" always resets to this default:
{
"name": "Developer"
}
How can I set up a different default JSON payload so it has the appropriate parameters for my service instead of this hard-coded version? I'd expect either to be able to specify this as part of the function code, or to enter it somewhere as part of the deployment settings, but I can't find any options for changing this at all.
Unfortunately, Google Cloud Run does not currently support setting a default or customized test payload in the Cloud Console's built-in "Test" UI.
If you’d like to test more than once, use an external tool like Postman or cURL which allows you to define your own default request and repeatedly send it, for example:
curl -X POST [YOUR_SERVICE_URL] \
-H "Authorization: Bearer $(gcloud auth print-identity-token)" \
-H "Content-Type: application/json" \
-d '{"your": "custom_payload"}'