From 62ca0c78ff9b56dfaf99af93082b47289034a40a Mon Sep 17 00:00:00 2001 From: James Russo Date: Thu, 22 Aug 2019 08:24:32 -0400 Subject: [PATCH] [csharp] Update UserAgent in the async version of ClientAPI execute method. (#3723) * move UserAgent up to the constructor * userAgent on both constructors. * update location of UserAgent * re-ran the petstore generation --- .../src/main/resources/csharp/ApiClient.mustache | 1 + .../OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache index 6e2a4aa2583..812ac789ae5 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache @@ -245,6 +245,7 @@ namespace {{packageName}}.Client var request = PrepareRequest( path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, contentType); + RestClient.UserAgent = Configuration.UserAgent; InterceptRequest(request); var response = await RestClient.Execute{{^netStandard}}TaskAsync{{/netStandard}}(request); InterceptResponse(request, response); diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs index 216469e1c8b..973dc3ec597 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs @@ -202,6 +202,7 @@ namespace Org.OpenAPITools.Client var request = PrepareRequest( path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, contentType); + RestClient.UserAgent = Configuration.UserAgent; InterceptRequest(request); var response = await RestClient.ExecuteTaskAsync(request); InterceptResponse(request, response);