aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-11-06 10:25:06 -0800
committerGravatar murgatroid99 <mlumish@google.com>2015-11-06 10:25:06 -0800
commit1099ace8f77504decd6e4576f1a995ff5fdb1eb8 (patch)
tree9861e49f30a86d6b9ddf63beb11bab13aee397d3 /src/node
parent5cd55dd441b43e33bb3e5abeaa3dce12644e6e87 (diff)
Ensure application and Node library user agent strings are together at the beginning
Diffstat (limited to 'src/node')
-rw-r--r--src/node/src/client.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/node/src/client.js b/src/node/src/client.js
index 3cdd550752..d57826781d 100644
--- a/src/node/src/client.js
+++ b/src/node/src/client.js
@@ -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);