Skip to content

Commit e7939bf

Browse files
averikitschgrayside
authored andcommitted
docs(samples): Update ReadMe and comments for samples (#225)
* docs(samples): Update ReadMe and comments for samples * docs(samples): Update ReadMe and comments for samples * Update bodyparser and comment * Fix merge error * Add comment for bodyParser * Update comment
1 parent 18d5cf8 commit e7939bf

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

cloud-tasks/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,4 @@ __Usage:__
167167

168168
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
169169
[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
170-
[product-docs]: https://cloud.google.com/tasks/docs/
170+
[product-docs]: https://cloud.google.com/tasks/docs/

cloud-tasks/createHttpTask.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ async function createHttpTask(
3535

3636
// TODO(developer): Uncomment these lines and replace with your values.
3737
// const project = 'my-project-id';
38-
// const queue = 'my-appengine-queue';
38+
// const queue = 'my-queue';
3939
// const location = 'us-central1';
40-
// const url = 'https://<project-id>.appspot.com/log_payload'
41-
// const options = {payload: 'hello'};
40+
// const url = 'https://example.com/taskhandler'
41+
// const payload = 'hello';
4242

4343
// Construct the fully qualified queue name.
4444
const parent = client.queuePath(project, location, queue);

cloud-tasks/createHttpTaskWithToken.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ async function createHttpTaskWithToken(
3636

3737
// TODO(developer): Uncomment these lines and replace with your values.
3838
// const project = 'my-project-id';
39-
// const queue = 'my-appengine-queue';
39+
// const queue = 'my-queue';
4040
// const location = 'us-central1';
41-
// const url = 'https://<project-id>.appspot.com/log_payload'
41+
// const url = 'https://example.com/taskhandler'
4242
// const email = 'client@<project-id>.iam.gserviceaccount.com'
43-
// const options = {payload: 'hello'};
43+
// const payload = 'hello';
4444

4545
// Construct the fully qualified queue name.
4646
const parent = client.queuePath(project, location, queue);

cloud-tasks/createTask.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ async function createTask(project, location, queue, payload, inSeconds) {
3131
// const project = 'my-project-id';
3232
// const queue = 'my-appengine-queue';
3333
// const location = 'us-central1';
34-
// const options = {payload: 'hello'};
34+
// const payload = 'hello';
35+
// const inSeconds = 30;
3536

3637
// Construct the fully qualified queue name.
3738
const parent = client.queuePath(project, location, queue);

cloud-tasks/quickstart.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async function createTask(project, location, queue, payload, inSeconds) {
3030
// const project = 'my-project-id';
3131
// const queue = 'my-appengine-queue';
3232
// const location = 'us-central1';
33-
// const options = {payload: 'hello'};
33+
// const payload = 'hello';
3434

3535
// Construct the fully qualified queue name.
3636
const parent = client.queuePath(project, location, queue);

cloud-tasks/server.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ const express = require('express');
2222
const app = express();
2323
app.enable('trust proxy');
2424

25-
app.use(bodyParser.raw());
26-
app.use(bodyParser.json());
27-
app.use(bodyParser.text());
25+
// By default, the Content-Type header of the Task request is set to "application/octet-stream"
26+
// see https://cloud.google.com/tasks/docs/reference/rest/v2beta3/projects.locations.queues.tasks#AppEngineHttpRequest
27+
app.use(bodyParser.raw({type: 'application/octet-stream'}));
2828

2929
app.get('/', (req, res) => {
3030
// Basic index to verify app is serving

0 commit comments

Comments
 (0)