Skip to content

Commit 92d6a3c

Browse files
pattishingcf-owl-bot[bot]averikitsch
authored
fix(issue-640): adding headers in task request samples (#642)
* fix: adding headers in task request refactor: updating readme with same fix * refactor: lint fixes * fix: switch content-type expected * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Averi Kitsch <[email protected]>
1 parent 944fbbf commit 92d6a3c

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

cloud-tasks/createHttpTask.js

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ function main(
5151

5252
const task = {
5353
httpRequest: {
54+
headers: {
55+
'Content-Type': 'text/plain',
56+
},
5457
httpMethod: 'POST',
5558
url,
5659
},

cloud-tasks/createHttpTaskWithToken.js

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ function main(
5151

5252
const task = {
5353
httpRequest: {
54+
headers: {
55+
'Content-Type': 'text/plain',
56+
},
5457
httpMethod: 'POST',
5558
url,
5659
oidcToken: {

cloud-tasks/createTask.js

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ function main(
4848

4949
const task = {
5050
appEngineHttpRequest: {
51+
headers: {
52+
'Content-Type': 'text/plain',
53+
},
5154
httpMethod: 'POST',
5255
relativeUri: '/log_payload',
5356
},
@@ -66,12 +69,14 @@ function main(
6669

6770
console.log('Sending task:');
6871
console.log(task);
72+
6973
// Send create task request.
7074
const request = {parent: parent, task: task};
7175
const [response] = await client.createTask(request);
7276
const name = response.name;
7377
console.log(`Created task ${name}`);
7478
}
79+
7580
createTask();
7681
// [END cloud_tasks_appengine_create_task]
7782
}

0 commit comments

Comments
 (0)