From 8228c6b068ae19af9657ec35468773b4cd2dd33c Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 9 Jan 2025 13:56:38 +0800 Subject: [PATCH] avoid duplicated header in csharp client --- .../src/main/resources/csharp/ApiClient.mustache | 2 +- .../net8/EchoApi/src/Org.OpenAPITools/Client/ApiClient.cs | 2 +- .../src/Org.OpenAPITools/Client/ApiClient.cs | 2 +- .../MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs | 2 +- .../net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs | 2 +- .../net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs | 2 +- .../net8/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs | 2 +- .../ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs | 2 +- .../net8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs | 2 +- .../UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs | 2 +- .../src/Org.OpenAPITools/Client/ApiClient.cs | 2 +- .../Petstore/src/Org.OpenAPITools/Client/ApiClient.cs | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache index ec45cbab3c56..c386535dd955 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache @@ -317,7 +317,7 @@ namespace {{packageName}}.Client { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } } diff --git a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ApiClient.cs index 8fab398a3f83..02d4488153a5 100644 --- a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ApiClient.cs @@ -317,7 +317,7 @@ private RestRequest NewRequest( { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } } diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs index c8d1224a3477..599c9d343945 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs @@ -317,7 +317,7 @@ private RestRequest NewRequest( { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } } diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs index 6fa812fa08ce..e100b716b25b 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs @@ -318,7 +318,7 @@ private RestRequest NewRequest( { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } } diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index 30158fdf49b7..276eb7bd1352 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -318,7 +318,7 @@ private RestRequest NewRequest( { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } } diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index 30158fdf49b7..276eb7bd1352 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -318,7 +318,7 @@ private RestRequest NewRequest( { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } } diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs index 332389566469..962685074380 100644 --- a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs @@ -317,7 +317,7 @@ private RestRequest NewRequest( { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } } diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs index 61c2f259c1f4..0afdd3e74a95 100644 --- a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs @@ -316,7 +316,7 @@ private RestRequest NewRequest( { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } } diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index 332389566469..962685074380 100644 --- a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -317,7 +317,7 @@ private RestRequest NewRequest( { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } } diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs index ea3384d5c5f8..1d4b18c2ecb2 100644 --- a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs @@ -316,7 +316,7 @@ private RestRequest NewRequest( { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } } diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs index 30158fdf49b7..276eb7bd1352 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs @@ -318,7 +318,7 @@ private RestRequest NewRequest( { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } } diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index 30158fdf49b7..276eb7bd1352 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -318,7 +318,7 @@ private RestRequest NewRequest( { foreach (var value in headerParam.Value) { - request.AddHeader(headerParam.Key, value); + request.AddOrUpdateHeader(headerParam.Key, value); } } }