diff options
author | murgatroid99 <mlumish@google.com> | 2016-05-09 14:55:34 -0700 |
---|---|---|
committer | murgatroid99 <mlumish@google.com> | 2016-05-09 14:55:34 -0700 |
commit | 3080ede82c5ac0ba8b5df80f180c1b4aaef9b4ae (patch) | |
tree | 989bf9ee9c6e75066d2e4622409bf131607b4bae /src | |
parent | 3386d78e273c69676bc8a249a72faf84d7709cd4 (diff) |
Allow Ruby client code to set a user agent
Diffstat (limited to 'src')
-rw-r--r-- | src/ruby/lib/grpc/generic/client_stub.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ruby/lib/grpc/generic/client_stub.rb b/src/ruby/lib/grpc/generic/client_stub.rb index 68e167a69f..12946fe819 100644 --- a/src/ruby/lib/grpc/generic/client_stub.rb +++ b/src/ruby/lib/grpc/generic/client_stub.rb @@ -49,7 +49,12 @@ module GRPC fail(TypeError, '!Channel') unless alt_chan.is_a?(Core::Channel) return alt_chan end - kw['grpc.primary_user_agent'] = "grpc-ruby/#{VERSION}" + if kw['grpc.primary_user_agent'].nil? + kw['grpc.primary_user_agent'] = '' + else + kw['grpc.primary_user_agent'] += ' ' + end + kw['grpc.primary_user_agent'] += "grpc-ruby/#{VERSION}" unless creds.is_a?(Core::ChannelCredentials) || creds.is_a?(Symbol) fail(TypeError, '!ChannelCredentials or Symbol') end |