diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache
index b74ab56ea10..3399d84297d 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache
@@ -170,7 +170,7 @@ namespace {{packageName}}.Client
/// Escaped string.
public string EscapeString(string str)
{
- return RestSharp.Contrib.HttpUtility.UrlEncode(str);
+ return RestSharp.Extensions.StringExtensions.UrlEncode(str);
}
///
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs
index 9041bbf42f0..4d87e7bd9c6 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs
@@ -49,6 +49,16 @@ namespace IO.Swagger.Client
{
get { return _defaultHeaderMap; }
}
+
+ ///
+ /// Gets the status code of the previous request
+ ///
+ public int StatusCode { get; private set; }
+
+ ///
+ /// Gets the response headers of the previous request
+ ///
+ public Dictionary ResponseHeaders { get; private set; }
// Creates and sets up a RestRequest prior to a call.
private RestRequest PrepareRequest(
@@ -110,7 +120,10 @@ namespace IO.Swagger.Client
{
var request = PrepareRequest(
path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
- return (Object)RestClient.Execute(request);
+ var response = RestClient.Execute(request);
+ StatusCode = (int) response.StatusCode;
+ ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
+ return (Object) response;
}
///
@@ -133,7 +146,10 @@ namespace IO.Swagger.Client
{
var request = PrepareRequest(
path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
- return (Object) await RestClient.ExecuteTaskAsync(request);
+ var response = await RestClient.ExecuteTaskAsync(request);
+ StatusCode = (int)response.StatusCode;
+ ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
+ return (Object)response;
}
///
@@ -154,7 +170,7 @@ namespace IO.Swagger.Client
/// Escaped string.
public string EscapeString(string str)
{
- return RestSharp.Contrib.HttpUtility.UrlEncode(str);
+ return RestSharp.Extensions.StringExtensions.UrlDecode(str);
}
///
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj
index 670402c0cd2..982ecc7a315 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj
+++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj
@@ -32,15 +32,15 @@
Lib\SwaggerClient\bin\Newtonsoft.Json.dll
-
- Lib\SwaggerClient\bin\RestSharp.dll
-
packages\NUnit.2.6.4\lib\nunit.framework.dll
+
+ Lib\SwaggerClient\bin\RestSharp.dll
+
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll
index 0fa7c24ab8a..8f38016c832 100755
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll and b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll differ
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb
index 1830197d9e7..290bbd5f2e0 100644
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb and b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb differ
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll
index 0fa7c24ab8a..8f38016c832 100755
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll and b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll differ
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb
index 1830197d9e7..290bbd5f2e0 100644
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb and b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb differ