File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,8 @@ protected string QueryString(ClientOptions options)
163163 protected static void AddDefaultHeaders ( HttpRequestMessage request , ClientOptions options )
164164 {
165165 request . Headers . Add ( "X-Stainless-Arch" , GetOSArch ( ) ) ;
166+ request . Headers . Add ( "X-Stainless-Lang" , "csharp" ) ;
167+ request . Headers . Add ( "X-Stainless-OS" , GetOS ( ) ) ;
166168
167169 if ( options . APIKey != null )
168170 {
@@ -183,4 +185,21 @@ or Architecture.LoongArch64
183185 or Architecture . Ppc64le => $ "other:{ RuntimeInformation . OSArchitecture } ",
184186 _ => "unknown" ,
185187 } ;
188+
189+ static string GetOS ( )
190+ {
191+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
192+ {
193+ return "Windows" ;
194+ }
195+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
196+ {
197+ return "MacOS" ;
198+ }
199+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
200+ {
201+ return "Linux" ;
202+ }
203+ return $ "Other:{ RuntimeInformation . OSDescription } ";
204+ }
186205}
You can’t perform that action at this time.
0 commit comments