From d97f316e423884d29428d7620d673b084808601e Mon Sep 17 00:00:00 2001 From: Rashmi A Badadale Date: Mon, 15 Dec 2025 09:27:26 -0500 Subject: [PATCH] xenapi: removed the default value for xenserver UserAgent Signed-off-by: Rashmi A Badadale --- ocaml/sdk-gen/csharp/autogen/src/Session.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ocaml/sdk-gen/csharp/autogen/src/Session.cs b/ocaml/sdk-gen/csharp/autogen/src/Session.cs index 5d999136833..8f2b363b7b3 100644 --- a/ocaml/sdk-gen/csharp/autogen/src/Session.cs +++ b/ocaml/sdk-gen/csharp/autogen/src/Session.cs @@ -48,7 +48,15 @@ public partial class Session : XenObject /// /// This string is used as the HTTP UserAgent for each request. /// - public static string UserAgent = $"XenAPI/{Helper.APIVersionString(API_Version.LATEST)}"; + public static string DefaultUserAgent => $"XenAPI/{Helper.APIVersionString(API_Version.LATEST)}"; + + private static string _userAgent = null; + + public static string UserAgent + { + get => _userAgent ?? DefaultUserAgent; + set => _userAgent = value; + } /// /// If null, no proxy is used, otherwise this proxy is used for each request. @@ -65,7 +73,7 @@ public Session(JsonRpcClient client) { client.Timeout = STANDARD_TIMEOUT; client.KeepAlive = true; - client.UserAgent = UserAgent; + UserAgent = !string.IsNullOrEmpty(client.UserAgent) ? client.UserAgent : UserAgent; client.WebProxy = Proxy; client.AllowAutoRedirect = true; JsonRpcClient = client;