Skip to content

Commit

Permalink
Cleaning up typos and comments for ServiceClient SetUserAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
tbombach committed May 25, 2016
1 parent 4624e6f commit 22f7fc7
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,48 +210,48 @@ protected void InitializeHttpClient(HttpClientHandler httpClientHandler, params
HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(type.FullName,
GetClientVersion()));
}
/// <summary>
///A mehtod to set user agent
/// </summary>

/// <summary>
/// Sets the product name to be used in the user agent header when making requests
/// </summary>
/// <param name="productName">Name of the product to be used in the user agent</param>
public bool SetUserAgent(string productName)
{
if(!_disposed && HttpClient != null)
if (!_disposed && HttpClient != null)
{
/// <summary>
/// Dispose the the old useragent.
/// </summary>
// Clear the old user agent
HttpClient.DefaultRequestHeaders.UserAgent.Clear();
HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName, GetClientVersion()));
// returns true if the userAgent was added

// Returns true if the user agent was set
return true;
}
/// <summary>
///returns false if the httpclient was disposed before invoking the method
/// </summary>

// Returns false if the HttpClient was disposed before invoking the method
return false;
}
/// <summary>
///Another method to setuseragent and its version
/// </summary>
public bool SetUserAgent(string productName,string version)

/// <summary>
/// Sets the product name and version to be used in the user agent header when making requests
/// </summary>
/// <param name="productName">Name of the product to be used in the user agent</param>
/// <param name="version">Version of the product to be used in the user agent</param>
public bool SetUserAgent(string productName, string version)
{
if(!_disposed && HttpClient != null)
if (!_disposed && HttpClient != null)
{
/// <summary>
/// Dispose the the old useragent.
/// </summary>
// Clear the old user agent
HttpClient.DefaultRequestHeaders.UserAgent.Clear();
HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName,version));
/// <summary>
// returns true if the userAgent was added
/// </summary>
HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName, version));

// Returns true if the user agent was set
return true;
}
/// <summary>
/// returns false if the httpclient was disposed before invoking the method
/// </summary>

// Returns false if the HttpClient was disposed before invoking the method
return false;
}

/// <summary>
/// Gets the AssemblyInformationalVersion if available
/// if not it gets the AssemblyFileVerion
Expand Down

0 comments on commit 22f7fc7

Please sign in to comment.