File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed
Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,9 @@ var Connect = function(args) {
215215 this . options = args || { } ;
216216
217217 // initalise the headers
218- this . headers = { } ;
218+ this . headers = {
219+ "User-Agent" : 'contentstack-cli/' + pkg . version
220+ } ;
219221
220222 // merging the args to input
221223 _ . merge ( inputs , args ) ;
@@ -478,16 +480,16 @@ Connect.prototype.stackInput = function (done) {
478480 ] , function ( err , result ) {
479481 if ( ! err && result ) {
480482 _ . merge ( inputs , result ) ;
481- self . headers . api_key = inputs . api_key ;
482- self . headers . access_token = inputs . access_token ;
483+ self . headers . api_key = inputs . api_key . trim ( ) ;
484+ self . headers . access_token = inputs . access_token . trim ( ) ;
483485 checkSite ( ) ;
484486 } else {
485487 done ( err ) ;
486488 }
487489 } ) ;
488490 } else {
489- self . headers . api_key = inputs . api_key = self . options . api_key ;
490- self . headers . access_token = inputs . access_token = self . options . access_token ;
491+ self . headers . api_key = inputs . api_key = self . options . api_key . trim ( ) ;
492+ self . headers . access_token = inputs . access_token = self . options . access_token . trim ( ) ;
491493 checkSite ( ) ;
492494 }
493495} ;
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ var prompt = require('prompt'),
1313 request = require ( 'request' ) ,
1414 _ = require ( "lodash" ) ,
1515 Q = require ( "q" ) ,
16- async = require ( 'async' ) ;
16+ async = require ( 'async' ) ,
17+ pkg = require ( './../package.json' ) ;
1718
1819/*
1920* Application variables
@@ -27,7 +28,8 @@ var utility = require('./utils'),
2728var inputs = { } ,
2829 api = config . get ( 'contentstack' ) ,
2930 headers = {
30- api_key : api . api_key
31+ api_key : api . api_key ,
32+ "User-Agent" : 'contentstack-cli/' + pkg . version
3133 } ,
3234 bound = 100 ,
3335 backup ;
Original file line number Diff line number Diff line change 1313var Q = require ( 'q' ) ,
1414 _ = require ( 'lodash' ) ,
1515 prompt = require ( 'prompt' ) ,
16- async = require ( 'async' ) ;
16+ async = require ( 'async' ) ,
17+ pkg = require ( './../package.json' ) ;
1718
1819/*
1920 * Application defined variables
@@ -30,7 +31,8 @@ function Utility(skip) {
3031 // setting the headers
3132 this . headers = {
3233 api_key : api . api_key ,
33- access_token : api . access_token
34+ access_token : api . access_token ,
35+ "User-Agent" : 'contentstack-cli/' + pkg . version
3436 } ;
3537 }
3638} ;
You can’t perform that action at this time.
0 commit comments