diff --git a/src/transporters.ts b/src/transporters.ts index 33dca5ff..0b4e2617 100644 --- a/src/transporters.ts +++ b/src/transporters.ts @@ -68,19 +68,9 @@ export class DefaultTransporter implements Transporter { ] = `${uaValue} ${DefaultTransporter.USER_AGENT}`; } // track google-auth-library-nodejs version: - const authVersion = `auth/${pkg.version}`; - if ( - opts.headers['x-goog-api-client'] && - !opts.headers['x-goog-api-client'].includes(authVersion) - ) { - opts.headers[ - 'x-goog-api-client' - ] = `${opts.headers['x-goog-api-client']} ${authVersion}`; - } else if (!opts.headers['x-goog-api-client']) { + if (!opts.headers['x-goog-api-client']) { const nodeVersion = process.version.replace(/^v/, ''); - opts.headers[ - 'x-goog-api-client' - ] = `gl-node/${nodeVersion} ${authVersion}`; + opts.headers['x-goog-api-client'] = `gl-node/${nodeVersion}`; } } return opts; diff --git a/test/test.transporters.ts b/test/test.transporters.ts index 08410db4..97a72465 100644 --- a/test/test.transporters.ts +++ b/test/test.transporters.ts @@ -58,11 +58,7 @@ describe('transporters', () => { const opts = transporter.configure({ url: '', }); - assert( - /^gl-node\/[.-\w$]+ auth\/[.-\w$]+$/.test( - opts.headers!['x-goog-api-client'] - ) - ); + assert(/^gl-node\/[.-\w$]+$/.test(opts.headers!['x-goog-api-client'])); }); it('should append to x-goog-api-client header if it exists', () => { @@ -70,9 +66,7 @@ describe('transporters', () => { headers: {'x-goog-api-client': 'gdcl/1.0.0'}, url: '', }); - assert( - /^gdcl\/[.-\w$]+ auth\/[.-\w$]+$/.test(opts.headers!['x-goog-api-client']) - ); + assert(/^gdcl\/[.-\w$]+$/.test(opts.headers!['x-goog-api-client'])); }); // see: https://github.com/googleapis/google-auth-library-nodejs/issues/819 @@ -84,9 +78,7 @@ describe('transporters', () => { let configuredOpts = transporter.configure(opts); configuredOpts = transporter.configure(opts); assert( - /^gdcl\/[.-\w$]+ auth\/[.-\w$]+$/.test( - configuredOpts.headers!['x-goog-api-client'] - ) + /^gdcl\/[.-\w$]+$/.test(configuredOpts.headers!['x-goog-api-client']) ); });