Skip to content

Commit d97f316

Browse files
committed
xenapi: removed the default value for xenserver UserAgent
Signed-off-by: Rashmi A Badadale <badadalerashmi@gmail.com>
1 parent 654cef3 commit d97f316

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ocaml/sdk-gen/csharp/autogen/src/Session.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ public partial class Session : XenObject<Session>
4848
/// <summary>
4949
/// This string is used as the HTTP UserAgent for each request.
5050
/// </summary>
51-
public static string UserAgent = $"XenAPI/{Helper.APIVersionString(API_Version.LATEST)}";
51+
public static string DefaultUserAgent => $"XenAPI/{Helper.APIVersionString(API_Version.LATEST)}";
52+
53+
private static string _userAgent = null;
54+
55+
public static string UserAgent
56+
{
57+
get => _userAgent ?? DefaultUserAgent;
58+
set => _userAgent = value;
59+
}
5260

5361
/// <summary>
5462
/// If null, no proxy is used, otherwise this proxy is used for each request.
@@ -65,7 +73,7 @@ public Session(JsonRpcClient client)
6573
{
6674
client.Timeout = STANDARD_TIMEOUT;
6775
client.KeepAlive = true;
68-
client.UserAgent = UserAgent;
76+
UserAgent = !string.IsNullOrEmpty(client.UserAgent) ? client.UserAgent : UserAgent;
6977
client.WebProxy = Proxy;
7078
client.AllowAutoRedirect = true;
7179
JsonRpcClient = client;

0 commit comments

Comments
 (0)