Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use common user agent format #278

Merged
merged 1 commit into from May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions Client.UnitTests/RequestMetadataTest.cs
Expand Up @@ -22,8 +22,7 @@ public async Task ShouldUseUserAgentHeader()

var entry = sendMetadata[0];
Assert.AreEqual("user-agent", entry.Key);
Assert.IsTrue(entry.Value.Contains("csharp"));
Assert.IsTrue(entry.Value.Contains(typeof(ZeebeClient).Assembly.GetName().Version.ToString()));
Assert.IsTrue(entry.Value.StartsWith("zeebe-client-csharp/" + typeof(ZeebeClient).Assembly.GetName().Version));
}
}
}
}
3 changes: 2 additions & 1 deletion Client/ZeebeClient.cs
Expand Up @@ -56,7 +56,8 @@ internal ZeebeClient(string address, TimeSpan? keepAlive, Func<int, TimeSpan> sl
this.loggerFactory = loggerFactory;

var channelOptions = new List<ChannelOption>();
var userAgentString = "client: csharp, version: " + typeof(ZeebeClient).Assembly.GetName().Version;
var clientVersion = typeof(ZeebeClient).Assembly.GetName().Version;
var userAgentString = $"zeebe-client-csharp/{clientVersion}";
var userAgentOption = new ChannelOption(ChannelOptions.PrimaryUserAgentString, userAgentString);
channelOptions.Add(userAgentOption);

Expand Down