From bdd3b85643c0865cf97400759bc144ed8a3ca8fe Mon Sep 17 00:00:00 2001 From: Andrew Schwartz Date: Sun, 9 Feb 2020 11:24:36 -0500 Subject: [PATCH] Use function-call request data in cloud function output --- examples/v2/cloud_functions/python/cloud_function.yaml | 2 +- examples/v2/cloud_functions/python/function/index.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/v2/cloud_functions/python/cloud_function.yaml b/examples/v2/cloud_functions/python/cloud_function.yaml index 8accf3acf..86401e809 100644 --- a/examples/v2/cloud_functions/python/cloud_function.yaml +++ b/examples/v2/cloud_functions/python/cloud_function.yaml @@ -23,7 +23,7 @@ resources: name: $(ref.function.name) data: | { - "hola": "mundo" + "message": "hola, mundo" } metadata: runtimePolicy: diff --git a/examples/v2/cloud_functions/python/function/index.js b/examples/v2/cloud_functions/python/function/index.js index 0282f3fd6..0d0b6273c 100644 --- a/examples/v2/cloud_functions/python/function/index.js +++ b/examples/v2/cloud_functions/python/function/index.js @@ -5,7 +5,8 @@ * @param {Object} res Cloud Function response context. */ exports.handler = function(req, res) { - console.log(req.body.message); + const { message } = req.body; + console.log(message); res.status(200).send( - {hello: 'world', time: new Date(), codeHash: process.env.codeHash}); + {hello: 'world', message, time: new Date(), codeHash: process.env.codeHash}); };