Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lowercase headers for HTTP/2 and improved logging #498

Merged
merged 2 commits into from
Oct 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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