Skip to content

Commit

Permalink
Send SDK version in headers (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz authored Nov 8, 2023
1 parent 1c1dbb9 commit fbcf01d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Passwordless/PasswordlessClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ namespace Passwordless;
[DebuggerDisplay("{DebuggerToString(),nq}")]
public class PasswordlessClient : IPasswordlessClient, IDisposable
{
private static readonly string SdkVersion =
typeof(PasswordlessClient).Assembly.GetName().Version?.ToString(3) ??
// This should never happen, unless the assembly had its metadata trimmed
"unknown";

private readonly HttpClient _http;
private readonly PasswordlessOptions _options;

Expand All @@ -21,7 +26,14 @@ private PasswordlessClient(HttpClient http, bool disposeClient, PasswordlessOpti
BaseAddress = new Uri(options.ApiUrl),
DefaultRequestHeaders =
{
{"ApiSecret", options.ApiSecret}
{
"ApiSecret",
options.ApiSecret
},
{
"Client-Version",
$".NET-{SdkVersion}"
}
}
};

Expand Down

0 comments on commit fbcf01d

Please sign in to comment.