Skip to content

Commit

Permalink
Merge pull request grpc#4083 from murgatroid99/node_user_agent_position
Browse files Browse the repository at this point in the history
Ensure application and Node library user agent strings are together at the beginning
  • Loading branch information
ctiller committed Nov 6, 2015
2 parents 31ee320 + 1099ace commit 8bbc4e0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/node/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,15 @@ exports.makeClientConstructor = function(methods, serviceName) {
if (!options) {
options = {};
}
options['grpc.primary_user_agent'] = 'grpc-node/' + version;
/* Append the grpc-node user agent string after the application user agent
* string, and put the combination at the beginning of the user agent string
*/
if (options['grpc.primary_user_agent']) {
options['grpc.primary_user_agent'] += ' ';
} else {
options['grpc.primary_user_agent'] = '';
}
options['grpc.primary_user_agent'] += 'grpc-node/' + version;
/* Private fields use $ as a prefix instead of _ because it is an invalid
* prefix of a method name */
this.$channel = new grpc.Channel(address, credentials, options);
Expand Down

0 comments on commit 8bbc4e0

Please sign in to comment.