Skip to content

Commit

Permalink
feat: add user-agent when sending HTTP request
Browse files Browse the repository at this point in the history
sdk current version + dotnet current version
  • Loading branch information
kjbtech committed Jul 25, 2024
1 parent a88605e commit 3a00820
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>0.2.0-beta</VersionPrefix>
<VersionPrefix>0.2.0-charlie.2</VersionPrefix>
<Authors>KJB Conseil</Authors>
<PackageProjectUrl>https://github.com/kjbconseil/logtoapi-dotnet-sdk</PackageProjectUrl>
<RepositoryUrl>https://github.com/kjbconseil/logtoapi-dotnet-sdk</RepositoryUrl>
Expand Down
3 changes: 3 additions & 0 deletions src/Logto.WebApi.Sdk/Common/ApiClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Net.Http.Headers;
using System.Reflection;
using System.Text;
using System.Text.Json;
using Logto.WebApi.Sdk.Authentication;
Expand Down Expand Up @@ -65,6 +66,8 @@ protected async Task AuthenticateAsync()
}

request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", _currentToken!.Value);
request.Headers.UserAgent.Add(new ProductInfoHeaderValue("logto-webapi-dotnet-sdk", Assembly.GetExecutingAssembly().GetName().Version?.ToString()));
request.Headers.UserAgent.Add(new ProductInfoHeaderValue("dotnet-version", Environment.Version.ToString()));

var response = await HttpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
Expand Down

0 comments on commit 3a00820

Please sign in to comment.