Skip to content

Commit 69176d2

Browse files
committed
'Authorization' header overwritting 'User-Agent' header
1 parent b0bc71c commit 69176d2

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Node/core/lib/bots/ChatConnector.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ var ChatConnector = (function () {
560560
}
561561
};
562562
ChatConnector.prototype.addUserAgent = function (options) {
563-
if (options.headers == null) {
563+
if (!options.headers) {
564564
options.headers = {};
565565
}
566566
options.headers['User-Agent'] = USER_AGENT;
@@ -569,9 +569,10 @@ var ChatConnector = (function () {
569569
if (this.settings.appId && this.settings.appPassword) {
570570
this.getAccessToken(function (err, token) {
571571
if (!err && token) {
572-
options.headers = {
573-
'Authorization': 'Bearer ' + token
574-
};
572+
if (!options.headers) {
573+
options.headers = {};
574+
}
575+
options.headers['Authorization'] = 'Bearer ' + token;
575576
cb(null);
576577
}
577578
else {

Node/core/src/bots/ChatConnector.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ export class ChatConnector implements IConnector, IBotStorage {
666666
}
667667

668668
private addUserAgent(options: request.Options): void {
669-
if (options.headers == null) {
669+
if (!options.headers) {
670670
options.headers = {};
671671
}
672672
options.headers['User-Agent'] = USER_AGENT;
@@ -676,9 +676,10 @@ export class ChatConnector implements IConnector, IBotStorage {
676676
if (this.settings.appId && this.settings.appPassword) {
677677
this.getAccessToken((err, token) => {
678678
if (!err && token) {
679-
options.headers = {
680-
'Authorization': 'Bearer ' + token
681-
};
679+
if (!options.headers) {
680+
options.headers = {};
681+
}
682+
options.headers['Authorization'] = 'Bearer ' + token
682683
cb(null);
683684
} else {
684685
cb(err);

0 commit comments

Comments
 (0)