File tree 2 files changed +5
-23
lines changed
2 files changed +5
-23
lines changed Original file line number Diff line number Diff line change @@ -68,19 +68,9 @@ export class DefaultTransporter implements Transporter {
68
68
] = `${ uaValue } ${ DefaultTransporter . USER_AGENT } ` ;
69
69
}
70
70
// track google-auth-library-nodejs version:
71
- const authVersion = `auth/${ pkg . version } ` ;
72
- if (
73
- opts . headers [ 'x-goog-api-client' ] &&
74
- ! opts . headers [ 'x-goog-api-client' ] . includes ( authVersion )
75
- ) {
76
- opts . headers [
77
- 'x-goog-api-client'
78
- ] = `${ opts . headers [ 'x-goog-api-client' ] } ${ authVersion } ` ;
79
- } else if ( ! opts . headers [ 'x-goog-api-client' ] ) {
71
+ if ( ! opts . headers [ 'x-goog-api-client' ] ) {
80
72
const nodeVersion = process . version . replace ( / ^ v / , '' ) ;
81
- opts . headers [
82
- 'x-goog-api-client'
83
- ] = `gl-node/${ nodeVersion } ${ authVersion } ` ;
73
+ opts . headers [ 'x-goog-api-client' ] = `gl-node/${ nodeVersion } ` ;
84
74
}
85
75
}
86
76
return opts ;
Original file line number Diff line number Diff line change @@ -58,21 +58,15 @@ describe('transporters', () => {
58
58
const opts = transporter . configure ( {
59
59
url : '' ,
60
60
} ) ;
61
- assert (
62
- / ^ g l - n o d e \/ [ . - \w $ ] + a u t h \/ [ . - \w $ ] + $ / . test (
63
- opts . headers ! [ 'x-goog-api-client' ]
64
- )
65
- ) ;
61
+ assert ( / ^ g l - n o d e \/ [ . - \w $ ] + $ / . test ( opts . headers ! [ 'x-goog-api-client' ] ) ) ;
66
62
} ) ;
67
63
68
64
it ( 'should append to x-goog-api-client header if it exists' , ( ) => {
69
65
const opts = transporter . configure ( {
70
66
headers : { 'x-goog-api-client' : 'gdcl/1.0.0' } ,
71
67
url : '' ,
72
68
} ) ;
73
- assert (
74
- / ^ g d c l \/ [ . - \w $ ] + a u t h \/ [ . - \w $ ] + $ / . test ( opts . headers ! [ 'x-goog-api-client' ] )
75
- ) ;
69
+ assert ( / ^ g d c l \/ [ . - \w $ ] + $ / . test ( opts . headers ! [ 'x-goog-api-client' ] ) ) ;
76
70
} ) ;
77
71
78
72
// see: https://github.com/googleapis/google-auth-library-nodejs/issues/819
@@ -84,9 +78,7 @@ describe('transporters', () => {
84
78
let configuredOpts = transporter . configure ( opts ) ;
85
79
configuredOpts = transporter . configure ( opts ) ;
86
80
assert (
87
- / ^ g d c l \/ [ . - \w $ ] + a u t h \/ [ . - \w $ ] + $ / . test (
88
- configuredOpts . headers ! [ 'x-goog-api-client' ]
89
- )
81
+ / ^ g d c l \/ [ . - \w $ ] + $ / . test ( configuredOpts . headers ! [ 'x-goog-api-client' ] )
90
82
) ;
91
83
} ) ;
92
84
You can’t perform that action at this time.
0 commit comments