Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions ocaml/sdk-gen/csharp/autogen/src/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,15 @@ public partial class Session : XenObject<Session>
/// <summary>
/// This string is used as the HTTP UserAgent for each request.
/// </summary>
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;
}

/// <summary>
/// If null, no proxy is used, otherwise this proxy is used for each request.
Expand All @@ -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;
Expand Down
Loading