File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,8 +115,10 @@ Service.prototype.request_ = function(reqOpts, callback) {
115115
116116 delete reqOpts . interceptors_ ;
117117
118+ var pkg = this . packageJson ;
118119 reqOpts . headers = extend ( { } , reqOpts . headers , {
119- 'User-Agent' : util . getUserAgentFromPackageJson ( this . packageJson )
120+ 'User-Agent' : util . getUserAgentFromPackageJson ( pkg ) ,
121+ 'x-goog-api-client' : `gl-node/${ process . versions . node } gccl/${ pkg . version } `
120122 } ) ;
121123
122124 return this . makeAuthenticatedRequest ( reqOpts , callback ) ;
Original file line number Diff line number Diff line change @@ -254,6 +254,19 @@ describe('Service', function() {
254254 service . request_ ( reqOpts , assert . ifError ) ;
255255 } ) ;
256256
257+ it ( 'should add the api-client header' , function ( done ) {
258+ service . makeAuthenticatedRequest = function ( reqOpts ) {
259+ var pkg = service . packageJson ;
260+ assert . strictEqual (
261+ reqOpts . headers [ 'x-goog-api-client' ] ,
262+ `gl-node/${ process . versions . node } gccl/${ pkg . version } `
263+ ) ;
264+ done ( ) ;
265+ } ;
266+
267+ service . request_ ( reqOpts , assert . ifError ) ;
268+ } ) ;
269+
257270 describe ( 'projectIdRequired' , function ( ) {
258271 describe ( 'false' , function ( ) {
259272 it ( 'should include the projectId' , function ( done ) {
You can’t perform that action at this time.
0 commit comments