File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ test("#setConnectionStatusFallback", () => {
2929} ) ;
3030
3131describe ( "#commonHeaders" , ( ) => {
32- const botAgent = "DirectLine/3.0 (directlinejs/test-version ; custom-bot-agent)" ;
32+ const botAgent = "DirectLine/3.0 (directlinejs; custom-bot-agent)" ;
3333 let botConnection ;
3434
3535 beforeEach ( ( ) => {
@@ -42,12 +42,11 @@ describe("#commonHeaders", () => {
4242 // @ts -ignore
4343 expect ( botConnection . commonHeaders ( ) ) . toEqual ( {
4444 "Authorization" : "Bearer secret-token" ,
45- "User-Agent" : `${ botAgent } (${ window . navigator . userAgent } )` ,
4645 "x-ms-bot-agent" : botAgent
4746 } ) ;
4847 } )
4948
50- test ( 'appends node environment agent when in node' , ( ) => {
49+ test . skip ( 'appends node environment agent when in node' , ( ) => {
5150 // @ts -ignore
5251 delete window . navigator
5352 // @ts -ignore
Original file line number Diff line number Diff line change @@ -889,31 +889,14 @@ export class DirectLine implements IBotConnection {
889889 }
890890
891891 private commonHeaders ( ) {
892- if ( ! this . _userAgent ) {
893- try {
894- this . _userAgent = window . navigator . userAgent || '' ;
895- } catch {
896- try {
897- // set node user agent
898- // @ts -ignore
899- const os = require ( 'os' ) ;
900- const { arch, platform, version } = process ;
901- this . _userAgent = `Node.js,Version=${ version } ; ${ platform } ${ os . release ( ) } ; ${ arch } `
902- } catch {
903- // no-op
904- }
905- }
906- }
907-
908892 return {
909893 "Authorization" : `Bearer ${ this . token } ` ,
910- "User-Agent" : `${ this . _botAgent } (${ this . _userAgent } )` ,
911894 "x-ms-bot-agent" : this . _botAgent
912895 } ;
913896 }
914897
915898 private getBotAgent ( customAgent : string = '' ) : string {
916- let clientAgent = ` directlinejs/ ${ process . env . VERSION || '0.0.0' } `
899+ let clientAgent = ' directlinejs'
917900
918901 if ( customAgent ) {
919902 clientAgent += `; ${ customAgent } `
You can’t perform that action at this time.
0 commit comments