File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 33using System . Collections . Specialized ;
44using System . Linq ;
55using System . Net . Http ;
6+ using System . Runtime . InteropServices ;
67using System . Text ;
78using System . Text . Json ;
89using 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}
You can’t perform that action at this time.
0 commit comments