diff --git a/src/__tests__/directLine.test.ts b/src/__tests__/directLine.test.ts index 63fbd145a..33ec2ecc3 100644 --- a/src/__tests__/directLine.test.ts +++ b/src/__tests__/directLine.test.ts @@ -29,7 +29,7 @@ test("#setConnectionStatusFallback", () => { }); describe("#commonHeaders", () => { - const botAgent = "DirectLine/3.0 (directlinejs/test-version; custom-bot-agent)"; + const botAgent = "DirectLine/3.0 (directlinejs; custom-bot-agent)"; let botConnection; beforeEach(() => { @@ -42,12 +42,11 @@ describe("#commonHeaders", () => { // @ts-ignore expect(botConnection.commonHeaders()).toEqual({ "Authorization": "Bearer secret-token", - "User-Agent": `${botAgent} (${window.navigator.userAgent})`, "x-ms-bot-agent": botAgent }); }) - test('appends node environment agent when in node', () => { + test.skip('appends node environment agent when in node', () => { // @ts-ignore delete window.navigator // @ts-ignore diff --git a/src/directLine.ts b/src/directLine.ts index 8c4113e8b..92af2370c 100644 --- a/src/directLine.ts +++ b/src/directLine.ts @@ -889,31 +889,14 @@ export class DirectLine implements IBotConnection { } private commonHeaders() { - if (!this._userAgent) { - try { - this._userAgent = window.navigator.userAgent || ''; - } catch { - try { - // set node user agent - // @ts-ignore - const os = require('os'); - const { arch, platform, version } = process; - this._userAgent = `Node.js,Version=${version}; ${platform} ${os.release()}; ${arch}` - } catch { - // no-op - } - } - } - return { "Authorization": `Bearer ${this.token}`, - "User-Agent": `${this._botAgent} (${this._userAgent})`, "x-ms-bot-agent": this._botAgent }; } private getBotAgent(customAgent: string = ''): string { - let clientAgent = `directlinejs/${process.env.VERSION || '0.0.0'}` + let clientAgent = 'directlinejs' if (customAgent) { clientAgent += `; ${customAgent}`