Skip to content

Commit

Permalink
Adds cache control header and updates all existing headers to be lowe…
Browse files Browse the repository at this point in the history
…rcase for HTTP/2 (#498)
  • Loading branch information
gguuss authored and jmdobry committed Oct 24, 2017
1 parent 8532458 commit 18e9b91
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions iot/http_example/cloudiot_http_example_nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ function publishAsync (messageCount, numMessages) {
const options = {
url: url,
headers: {
'Authorization': 'Bearer ' + authToken
'authorization': 'Bearer ' + authToken,
'content-type': 'application/json',
'cache-control': 'no-cache'

},
json: true,
body: postData
Expand All @@ -132,10 +135,12 @@ function publishAsync (messageCount, numMessages) {
const delayMs = argv.message_type === 'events' ? 1000 : 2000;
request.post(options, function (error, response, body) {
if (error) {
return console.error('Received error: ', error);
console.error('Received error: ', error);
} else if (response.body.error) {
console.error('Received error: ' + JSON.stringify(response.body.error));
} else {
console.log('Message sent.');
}
console.log('Received response: ');
console.dir(response);
if (messageCount < numMessages) {
// If we have published fewer than numMessage messages, publish payload
// messageCount + 1.
Expand Down

0 comments on commit 18e9b91

Please sign in to comment.