Skip to content

Commit e0698da

Browse files
feat(client): send X-Stainless-Arch header
1 parent b2442cf commit e0698da

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/ArcadeDotnet/Core/ParamsBase.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Specialized;
44
using System.Linq;
55
using System.Net.Http;
6+
using System.Runtime.InteropServices;
67
using System.Text;
78
using System.Text.Json;
89
using Web = System.Web;
@@ -166,9 +167,25 @@ protected string QueryString(ClientOptions options)
166167

167168
protected static void AddDefaultHeaders(HttpRequestMessage request, ClientOptions options)
168169
{
170+
request.Headers.Add("X-Stainless-Arch", GetOSArch());
171+
169172
if (options.APIKey != null)
170173
{
171174
request.Headers.Add("Authorization", options.APIKey);
172175
}
173176
}
177+
178+
static string GetOSArch() =>
179+
RuntimeInformation.OSArchitecture switch
180+
{
181+
Architecture.X86 => "x32",
182+
Architecture.X64 => "x64",
183+
Architecture.Arm => "arm",
184+
Architecture.Arm64 or Architecture.Armv6 => "arm64",
185+
Architecture.Wasm
186+
or Architecture.S390x
187+
or Architecture.LoongArch64
188+
or Architecture.Ppc64le => $"other:{RuntimeInformation.OSArchitecture}",
189+
_ => "unknown",
190+
};
174191
}

0 commit comments

Comments
 (0)