diff --git a/cloud-tasks/README.md b/cloud-tasks/README.md index efe1ccf436..e949dad8a7 100644 --- a/cloud-tasks/README.md +++ b/cloud-tasks/README.md @@ -167,4 +167,4 @@ __Usage:__ [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-tasks&page=editor&open_in_editor=samples/README.md -[product-docs]: https://cloud.google.com/tasks/docs/ \ No newline at end of file +[product-docs]: https://cloud.google.com/tasks/docs/ diff --git a/cloud-tasks/createHttpTask.js b/cloud-tasks/createHttpTask.js index d4700aaa59..39aae9ae33 100644 --- a/cloud-tasks/createHttpTask.js +++ b/cloud-tasks/createHttpTask.js @@ -35,10 +35,10 @@ async function createHttpTask( // TODO(developer): Uncomment these lines and replace with your values. // const project = 'my-project-id'; - // const queue = 'my-appengine-queue'; + // const queue = 'my-queue'; // const location = 'us-central1'; - // const url = 'https://.appspot.com/log_payload' - // const options = {payload: 'hello'}; + // const url = 'https://example.com/taskhandler' + // const payload = 'hello'; // Construct the fully qualified queue name. const parent = client.queuePath(project, location, queue); diff --git a/cloud-tasks/createHttpTaskWithToken.js b/cloud-tasks/createHttpTaskWithToken.js index f86ec24fd1..baacd830cd 100644 --- a/cloud-tasks/createHttpTaskWithToken.js +++ b/cloud-tasks/createHttpTaskWithToken.js @@ -36,11 +36,11 @@ async function createHttpTaskWithToken( // TODO(developer): Uncomment these lines and replace with your values. // const project = 'my-project-id'; - // const queue = 'my-appengine-queue'; + // const queue = 'my-queue'; // const location = 'us-central1'; - // const url = 'https://.appspot.com/log_payload' + // const url = 'https://example.com/taskhandler' // const email = 'client@.iam.gserviceaccount.com' - // const options = {payload: 'hello'}; + // const payload = 'hello'; // Construct the fully qualified queue name. const parent = client.queuePath(project, location, queue); diff --git a/cloud-tasks/createTask.js b/cloud-tasks/createTask.js index 416c863398..3c709f1bcf 100644 --- a/cloud-tasks/createTask.js +++ b/cloud-tasks/createTask.js @@ -31,7 +31,8 @@ async function createTask(project, location, queue, payload, inSeconds) { // const project = 'my-project-id'; // const queue = 'my-appengine-queue'; // const location = 'us-central1'; - // const options = {payload: 'hello'}; + // const payload = 'hello'; + // const inSeconds = 30; // Construct the fully qualified queue name. const parent = client.queuePath(project, location, queue); diff --git a/cloud-tasks/quickstart.js b/cloud-tasks/quickstart.js index 4c01c6ca3e..531abbd8b5 100644 --- a/cloud-tasks/quickstart.js +++ b/cloud-tasks/quickstart.js @@ -30,7 +30,7 @@ async function createTask(project, location, queue, payload, inSeconds) { // const project = 'my-project-id'; // const queue = 'my-appengine-queue'; // const location = 'us-central1'; - // const options = {payload: 'hello'}; + // const payload = 'hello'; // Construct the fully qualified queue name. const parent = client.queuePath(project, location, queue); diff --git a/cloud-tasks/server.js b/cloud-tasks/server.js index 5812013a48..871d448cb4 100644 --- a/cloud-tasks/server.js +++ b/cloud-tasks/server.js @@ -22,9 +22,9 @@ const express = require('express'); const app = express(); app.enable('trust proxy'); -app.use(bodyParser.raw()); -app.use(bodyParser.json()); -app.use(bodyParser.text()); +// By default, the Content-Type header of the Task request is set to "application/octet-stream" +// see https://cloud.google.com/tasks/docs/reference/rest/v2beta3/projects.locations.queues.tasks#AppEngineHttpRequest +app.use(bodyParser.raw({type: 'application/octet-stream'})); app.get('/', (req, res) => { // Basic index to verify app is serving