From 8a2fd9ab80621a79a90eecdc467e4a2a2a2d008a Mon Sep 17 00:00:00 2001 From: abhivijay96 Date: Sat, 7 May 2016 23:01:41 +0530 Subject: [PATCH 1/8] Update ServiceClient.cs --- .../ServiceClient.cs | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs index 6763f4e6641fa..8051c80557e38 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs @@ -207,10 +207,38 @@ protected void InitializeHttpClient(HttpClientHandler httpClientHandler, params FirstMessageHandler = currentHandler; HttpClient = newClient; Type type = this.GetType(); - HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(type.FullName, + //setting userAgentBelow is removed because now the client can set it using SetUserAgent method + /* HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(type.FullName, + GetClientVersion()));*/ + } + + //A mehtod to set user agent + public bool SetUserAgent(string produtName) + { + if(!_disposed && HttpClient != null) + { + HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName, GetClientVersion())); + // returns true if the userAgent was added + return true; + } + // returns false if the httpclient was disposed before invoking the method + return false; + } + + //Another method to setuseragent and it's version + + public bool SetUserAgent(string produtName,string version) + { + if(!_disposed && HttpClient != null) + { + HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName,version); + // returns true if the userAgent was added + return true; + } + // returns false if the httpclient was disposed before invoking the method + return false; } - /// /// Gets the AssemblyInformationalVersion if available /// if not it gets the AssemblyFileVerion From 79b30937cc4bbc376cc604a9bfffec07fc2efcc9 Mon Sep 17 00:00:00 2001 From: abhivijay96 Date: Sat, 7 May 2016 23:03:48 +0530 Subject: [PATCH 2/8] Update ServiceClient.cs --- .../CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs index 8051c80557e38..8871933963ae8 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs @@ -217,8 +217,7 @@ public bool SetUserAgent(string produtName) { if(!_disposed && HttpClient != null) { - HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName, - GetClientVersion())); + HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName, GetClientVersion())); // returns true if the userAgent was added return true; } From 328825f82e7aa1ac94c146a42f3d68652d901937 Mon Sep 17 00:00:00 2001 From: abhivijay96 Date: Tue, 17 May 2016 00:23:42 +0530 Subject: [PATCH 3/8] Update ServiceClient.cs --- .../CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs index 8871933963ae8..d6ae6d7146e80 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs @@ -213,7 +213,7 @@ protected void InitializeHttpClient(HttpClientHandler httpClientHandler, params } //A mehtod to set user agent - public bool SetUserAgent(string produtName) + public bool SetUserAgent(string productName) { if(!_disposed && HttpClient != null) { @@ -227,7 +227,7 @@ public bool SetUserAgent(string produtName) //Another method to setuseragent and it's version - public bool SetUserAgent(string produtName,string version) + public bool SetUserAgent(string productName,string version) { if(!_disposed && HttpClient != null) { From ca5a350fd366332b21e8549bcc96e4206e7b6f24 Mon Sep 17 00:00:00 2001 From: abhivijay96 Date: Tue, 17 May 2016 07:36:44 +0530 Subject: [PATCH 4/8] Update ServiceClient.cs --- .../Microsoft.Rest.ClientRuntime/ServiceClient.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs index d6ae6d7146e80..78142ca5759bb 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs @@ -208,8 +208,8 @@ protected void InitializeHttpClient(HttpClientHandler httpClientHandler, params HttpClient = newClient; Type type = this.GetType(); //setting userAgentBelow is removed because now the client can set it using SetUserAgent method - /* HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(type.FullName, - GetClientVersion()));*/ + HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(type.FullName, + GetClientVersion())); } //A mehtod to set user agent @@ -217,6 +217,10 @@ public bool SetUserAgent(string productName) { if(!_disposed && HttpClient != null) { + /// + /// Dispose the the old useragent. + /// + HttpClient.DefaultRequestHeaders.UserAgent.Clear(); HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName, GetClientVersion())); // returns true if the userAgent was added return true; @@ -231,6 +235,10 @@ public bool SetUserAgent(string productName,string version) { if(!_disposed && HttpClient != null) { + /// + /// Dispose the the old useragent. + /// + HttpClient.DefaultRequestHeaders.UserAgent.Clear(); HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName,version); // returns true if the userAgent was added return true; From 2c27c28eb867b4c059e8e1c363e5282ad48f5a49 Mon Sep 17 00:00:00 2001 From: abhivijay96 Date: Tue, 17 May 2016 07:38:34 +0530 Subject: [PATCH 5/8] Update ServiceClient.cs --- .../CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs index 78142ca5759bb..4012b737cf69a 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs @@ -207,7 +207,6 @@ protected void InitializeHttpClient(HttpClientHandler httpClientHandler, params FirstMessageHandler = currentHandler; HttpClient = newClient; Type type = this.GetType(); - //setting userAgentBelow is removed because now the client can set it using SetUserAgent method HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(type.FullName, GetClientVersion())); } From 4630b69e45ab1448a40d9c76f9ef3eccac60d460 Mon Sep 17 00:00:00 2001 From: abhivijay96 Date: Wed, 18 May 2016 23:37:30 +0530 Subject: [PATCH 6/8] Update ServiceClient.cs --- .../CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs index 4012b737cf69a..104af8135770e 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs @@ -238,7 +238,7 @@ public bool SetUserAgent(string productName,string version) /// Dispose the the old useragent. /// HttpClient.DefaultRequestHeaders.UserAgent.Clear(); - HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName,version); + HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName,version)); // returns true if the userAgent was added return true; } From 4624e6f04a96201ad3fa55ee176cc46243418c9f Mon Sep 17 00:00:00 2001 From: abhivijay96 Date: Thu, 19 May 2016 00:07:26 +0530 Subject: [PATCH 7/8] Update ServiceClient.cs --- .../ServiceClient.cs | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs index 104af8135770e..bba5be03f8a2a 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs @@ -210,8 +210,9 @@ protected void InitializeHttpClient(HttpClientHandler httpClientHandler, params HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(type.FullName, GetClientVersion())); } - - //A mehtod to set user agent + /// + ///A mehtod to set user agent + /// public bool SetUserAgent(string productName) { if(!_disposed && HttpClient != null) @@ -224,12 +225,14 @@ public bool SetUserAgent(string productName) // returns true if the userAgent was added return true; } - // returns false if the httpclient was disposed before invoking the method + /// + ///returns false if the httpclient was disposed before invoking the method + /// return false; } - - //Another method to setuseragent and it's version - + /// + ///Another method to setuseragent and its version + /// public bool SetUserAgent(string productName,string version) { if(!_disposed && HttpClient != null) @@ -239,10 +242,14 @@ public bool SetUserAgent(string productName,string version) /// HttpClient.DefaultRequestHeaders.UserAgent.Clear(); HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName,version)); - // returns true if the userAgent was added + /// + // returns true if the userAgent was added + /// return true; } - // returns false if the httpclient was disposed before invoking the method + /// + /// returns false if the httpclient was disposed before invoking the method + /// return false; } /// From 22f7fc7a9291f6860907242ccdb93d33adb353e1 Mon Sep 17 00:00:00 2001 From: Thomas Bombach Date: Wed, 25 May 2016 16:30:51 -0700 Subject: [PATCH 8/8] Cleaning up typos and comments for ServiceClient SetUserAgent --- .../ServiceClient.cs | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs index bba5be03f8a2a..d33ab3bdeef99 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/ServiceClient.cs @@ -210,48 +210,48 @@ protected void InitializeHttpClient(HttpClientHandler httpClientHandler, params HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(type.FullName, GetClientVersion())); } - /// - ///A mehtod to set user agent - /// + + /// + /// Sets the product name to be used in the user agent header when making requests + /// + /// Name of the product to be used in the user agent public bool SetUserAgent(string productName) { - if(!_disposed && HttpClient != null) + if (!_disposed && HttpClient != null) { - /// - /// Dispose the the old useragent. - /// + // 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; } - /// - ///returns false if the httpclient was disposed before invoking the method - /// + + // Returns false if the HttpClient was disposed before invoking the method return false; } - /// - ///Another method to setuseragent and its version - /// - public bool SetUserAgent(string productName,string version) + + /// + /// Sets the product name and version to be used in the user agent header when making requests + /// + /// Name of the product to be used in the user agent + /// Version of the product to be used in the user agent + public bool SetUserAgent(string productName, string version) { - if(!_disposed && HttpClient != null) + if (!_disposed && HttpClient != null) { - /// - /// Dispose the the old useragent. - /// + // Clear the old user agent HttpClient.DefaultRequestHeaders.UserAgent.Clear(); - HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName,version)); - /// - // returns true if the userAgent was added - /// + HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(productName, version)); + + // Returns true if the user agent was set return true; } - /// - /// returns false if the httpclient was disposed before invoking the method - /// + + // Returns false if the HttpClient was disposed before invoking the method return false; } + /// /// Gets the AssemblyInformationalVersion if available /// if not it gets the AssemblyFileVerion