Skip to content

Commit fbcf01d

Browse files
authored
Send SDK version in headers (#68)
1 parent 1c1dbb9 commit fbcf01d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Passwordless/PasswordlessClient.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ namespace Passwordless;
1111
[DebuggerDisplay("{DebuggerToString(),nq}")]
1212
public class PasswordlessClient : IPasswordlessClient, IDisposable
1313
{
14+
private static readonly string SdkVersion =
15+
typeof(PasswordlessClient).Assembly.GetName().Version?.ToString(3) ??
16+
// This should never happen, unless the assembly had its metadata trimmed
17+
"unknown";
18+
1419
private readonly HttpClient _http;
1520
private readonly PasswordlessOptions _options;
1621

@@ -21,7 +26,14 @@ private PasswordlessClient(HttpClient http, bool disposeClient, PasswordlessOpti
2126
BaseAddress = new Uri(options.ApiUrl),
2227
DefaultRequestHeaders =
2328
{
24-
{"ApiSecret", options.ApiSecret}
29+
{
30+
"ApiSecret",
31+
options.ApiSecret
32+
},
33+
{
34+
"Client-Version",
35+
$".NET-{SdkVersion}"
36+
}
2537
}
2638
};
2739

0 commit comments

Comments
 (0)