From 202e3b33c19b88168287a75d52a13321c8198699 Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:17:34 +0200 Subject: [PATCH 1/3] Send SDK version in headers --- src/Passwordless/PasswordlessClient.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Passwordless/PasswordlessClient.cs b/src/Passwordless/PasswordlessClient.cs index 941bf05..178f7ef 100644 --- a/src/Passwordless/PasswordlessClient.cs +++ b/src/Passwordless/PasswordlessClient.cs @@ -21,7 +21,14 @@ private PasswordlessClient(HttpClient http, bool disposeClient, PasswordlessOpti BaseAddress = new Uri(options.ApiUrl), DefaultRequestHeaders = { - {"ApiSecret", options.ApiSecret} + { + "ApiSecret", + options.ApiSecret + }, + { + "Client-Version", + $".NET-{typeof(PasswordlessClient).Assembly.GetName().Version.ToString(3)}" + } } }; From a2b8ed731f681b8f633c363e8220ecef0c10201c Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:25:31 +0200 Subject: [PATCH 2/3] asd --- src/Passwordless/PasswordlessClient.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Passwordless/PasswordlessClient.cs b/src/Passwordless/PasswordlessClient.cs index 178f7ef..c3b4df7 100644 --- a/src/Passwordless/PasswordlessClient.cs +++ b/src/Passwordless/PasswordlessClient.cs @@ -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 + throw new InvalidOperationException("Could not determine SDK version."); + private readonly HttpClient _http; private readonly PasswordlessOptions _options; @@ -27,7 +32,7 @@ private PasswordlessClient(HttpClient http, bool disposeClient, PasswordlessOpti }, { "Client-Version", - $".NET-{typeof(PasswordlessClient).Assembly.GetName().Version.ToString(3)}" + $".NET-{SdkVersion}" } } }; From 2f6ebd988d189f97c5a6a67b13aee541ce484835 Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Wed, 8 Nov 2023 17:32:21 +0200 Subject: [PATCH 3/3] Less hardcore --- src/Passwordless/PasswordlessClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Passwordless/PasswordlessClient.cs b/src/Passwordless/PasswordlessClient.cs index c3b4df7..21f260f 100644 --- a/src/Passwordless/PasswordlessClient.cs +++ b/src/Passwordless/PasswordlessClient.cs @@ -14,7 +14,7 @@ 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 - throw new InvalidOperationException("Could not determine SDK version."); + "unknown"; private readonly HttpClient _http; private readonly PasswordlessOptions _options;