Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for ASV and DEVPORT-764 #178

Merged
merged 1 commit into from
Dec 14, 2021
Merged
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
15 changes: 14 additions & 1 deletion src/AvaTaxClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public partial class AvaTaxClient
/// Tracks the amount of time spent on the most recent API call
/// </summary>
public CallDuration LastCallTime { get; set; }
/// <summary>
/// Client Id - passed in request header
/// </summary>
public readonly string ClientID;

/// <summary>
/// Returns the version of the SDK that was compiled
Expand Down Expand Up @@ -62,6 +66,7 @@ public partial class AvaTaxClient
/// <param name="userConfiguration">User configuration</param>
public AvaTaxClient(string appName, string appVersion, string machineName, AvaTaxEnvironment environment, UserConfiguration userConfiguration = null)
{
ClientID= String.Format("{0}; {1}; {2}; {{0}}; {3}", appName, appVersion, "CSharpRestClient", machineName);
// Redo the client identifier
WithClientIdentifier(appName, appVersion, machineName);
if (userConfiguration != null)
Expand All @@ -87,6 +92,7 @@ public AvaTaxClient(string appName, string appVersion, string machineName, AvaTa
/// <param name="userConfiguration">User configuration</param>
public AvaTaxClient(string appName, string appVersion, string machineName, Uri customEnvironment, UserConfiguration userConfiguration = null)
{
ClientID = String.Format("{0}; {1}; {2}; {{0}}; {3}", appName, appVersion, "CSharpRestClient", machineName);
// Redo the client identifier
WithClientIdentifier(appName, appVersion, machineName);
if (userConfiguration != null)
Expand Down Expand Up @@ -176,7 +182,14 @@ public AvaTaxClient WithCustomHeader(string name, string value)
/// <returns></returns>
public AvaTaxClient WithClientIdentifier(string appName, string appVersion, string machineName)
{
_clientHeaders.Add(Constants.AVALARA_CLIENT_HEADER, String.Format("{0}; {1}; {2}; {3}; {4}", appName, appVersion, "CSharpRestClient", API_VERSION, machineName));
if (!_clientHeaders.ContainsKey(Constants.AVALARA_CLIENT_HEADER))
{
_clientHeaders.Add(Constants.AVALARA_CLIENT_HEADER, ClientID);
}
else
{
_clientHeaders[Constants.AVALARA_CLIENT_HEADER] = ClientID;
}
return this;
}
#endregion
Expand Down