From 21755939c18133a49975d0243477b1e6e0a7b7a0 Mon Sep 17 00:00:00 2001 From: Wiebren Braakman Date: Thu, 10 Sep 2026 17:23:29 +0200 Subject: [PATCH] [csharp] fix: stop percent-encoding the User-Agent Configuration.mustache wraps the user agent in WebUtility.UrlEncode, so the "/" that separates product from version reaches the server as %2F and a space reaches it as "+": the default agent goes out as OpenAPI-Generator%2F1.0.0%2Fcsharp, and httpUserAgent=my-client/1.2.3 goes out as my-client%2F1.2.3. A User-Agent is not a URL component and nothing downstream decodes it. The encoding arrived with the RestSharp v108 upgrade in #12789 for a "user agent bug" the PR does not describe. RestSharp 112 accepts the unencoded value: pointed at a raw socket, RestClientOptions.UserAgent = "OpenAPI- Generator/1.0.0/csharp" puts exactly that on the wire. The other two libraries sharing this template never validated it either - httpclient uses TryAddWithoutValidation, unityWebRequest SetRequestHeader - and the sibling csharp-functions generator has always assigned the value unencoded. Drop the call in both restsharp Configuration templates. using System.Net stays for WebProxy. Every csharp sample changes by exactly this one line. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_016AMTM9KKdWLnfdCCiN32pM --- .../resources/csharp/Configuration.mustache | 2 +- .../csharp/Configuration.v790.mustache | 2 +- .../CSharpClientCodegenTest.java | 29 +++++++++++++++++++ .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- .../Org.OpenAPITools/Client/Configuration.cs | 2 +- 26 files changed, 54 insertions(+), 25 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache b/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache index 39dbd9c03943..1cab73f08757 100644 --- a/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache @@ -126,7 +126,7 @@ namespace {{packageName}}.Client public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("{{httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{packageVersion}}/csharp{{/httpUserAgent}}"); + UserAgent = "{{httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{packageVersion}}/csharp{{/httpUserAgent}}"; BasePath = "{{{basePath}}}"; DefaultHeaders = new {{^net35}}Concurrent{{/net35}}Dictionary(); ApiKey = new {{^net35}}Concurrent{{/net35}}Dictionary(); diff --git a/modules/openapi-generator/src/main/resources/csharp/Configuration.v790.mustache b/modules/openapi-generator/src/main/resources/csharp/Configuration.v790.mustache index 2753aafb39cb..5a57dd31c506 100644 --- a/modules/openapi-generator/src/main/resources/csharp/Configuration.v790.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/Configuration.v790.mustache @@ -126,7 +126,7 @@ namespace {{packageName}}.Client public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("{{httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{packageVersion}}/csharp{{/httpUserAgent}}"); + UserAgent = "{{httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{packageVersion}}/csharp{{/httpUserAgent}}"; BasePath = "{{{basePath}}}"; DefaultHeaders = new {{^net35}}Concurrent{{/net35}}Dictionary(); ApiKey = new {{^net35}}Concurrent{{/net35}}Dictionary(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java index 7608b2513f01..f9de3e8af006 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java @@ -203,6 +203,35 @@ public void testHandleConstantParams() throws IOException { "localVarRequestOptions.HeaderParameters.Add(\"X-CUSTOM_CONSTANT_HEADER\", Org.OpenAPITools.Client.ClientUtils.ParameterToString(\"CONSTANT_VALUE\"));"); } + @Test + public void testUserAgentIsNotUrlEncoded() throws IOException { + // both restsharp Configuration templates: the default one and the useIntForTimeout v7.9.0 fallback + for (boolean useIntForTimeout : new boolean[]{false, true}) { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore.yaml"); + final DefaultGenerator defaultGenerator = new DefaultGenerator(); + final ClientOptInput clientOptInput = new ClientOptInput(); + clientOptInput.openAPI(openAPI); + CSharpClientCodegen cSharpClientCodegen = new CSharpClientCodegen(); + cSharpClientCodegen.setLibrary("restsharp"); + cSharpClientCodegen.setOutputDir(output.getAbsolutePath()); + cSharpClientCodegen.additionalProperties().put(CodegenConstants.HTTP_USER_AGENT, "my-client/1.2.3 (linux)"); + cSharpClientCodegen.additionalProperties().put("useIntForTimeout", useIntForTimeout); + clientOptInput.config(cSharpClientCodegen); + defaultGenerator.opts(clientOptInput); + + Map files = defaultGenerator.generate().stream() + .collect(Collectors.toMap(File::getPath, Function.identity())); + + File configuration = files + .get(Paths.get(output.getAbsolutePath(), "src", "Org.OpenAPITools", "Client", "Configuration.cs").toString()); + assertNotNull(configuration); + assertFileContains(configuration.toPath(), "UserAgent = \"my-client/1.2.3 (linux)\";"); + assertFileNotContains(configuration.toPath(), "UserAgent = WebUtility.UrlEncode("); + } + } + @Test public void test31specAdditionalPropertiesOfOneOf() throws IOException { // for https://github.com/OpenAPITools/openapi-generator/pull/18772 diff --git a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs index 13e61760f2b9..c2e5770043a8 100644 --- a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs @@ -118,7 +118,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://localhost:3000"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs index 9a4b99cd8121..3e60a8b14471 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs @@ -112,7 +112,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://localhost"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/httpclient/net10/Petstore-nonPublicApi/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/httpclient/net10/Petstore-nonPublicApi/src/Org.OpenAPITools/Client/Configuration.cs index fac485f8929e..6e52ba136675 100644 --- a/samples/client/petstore/csharp/httpclient/net10/Petstore-nonPublicApi/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/httpclient/net10/Petstore-nonPublicApi/src/Org.OpenAPITools/Client/Configuration.cs @@ -117,7 +117,7 @@ internal class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/httpclient/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/httpclient/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 601dfdb2f3e7..72ca7062a479 100644 --- a/samples/client/petstore/csharp/httpclient/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/httpclient/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -122,7 +122,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore-nonPublicApi/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/httpclient/net9/Petstore-nonPublicApi/src/Org.OpenAPITools/Client/Configuration.cs index fac485f8929e..6e52ba136675 100644 --- a/samples/client/petstore/csharp/httpclient/net9/Petstore-nonPublicApi/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/httpclient/net9/Petstore-nonPublicApi/src/Org.OpenAPITools/Client/Configuration.cs @@ -117,7 +117,7 @@ internal class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 601dfdb2f3e7..72ca7062a479 100644 --- a/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -122,7 +122,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index ed3aecacd924..fff7cc8bf22a 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -117,7 +117,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/net10/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net10/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs index c89eee968eca..d0c3efbf516c 100644 --- a/samples/client/petstore/csharp/restsharp/net10/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net10/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs @@ -118,7 +118,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index bd0f59f6356a..0b9bfede48d6 100644 --- a/samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -123,7 +123,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://localhost/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs index 1176107c56fa..d7de9adc4540 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs @@ -113,7 +113,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index e254dd2413ab..f5e4195dacae 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -123,7 +123,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index e254dd2413ab..f5e4195dacae 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -123,7 +123,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs index ccbe76060856..3baf66f1280b 100644 --- a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs @@ -123,7 +123,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs index d7146853e0f9..d4e6f5c5c282 100644 --- a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs @@ -117,7 +117,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://localhost"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index ccbe76060856..3baf66f1280b 100644 --- a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -123,7 +123,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs index 5a7f7e948236..1b69048b617d 100644 --- a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs @@ -117,7 +117,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://localhost"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs index c89eee968eca..d0c3efbf516c 100644 --- a/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs @@ -118,7 +118,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs index ccbe76060856..3baf66f1280b 100644 --- a/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs @@ -123,7 +123,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs index 3ea2a481c169..551f61a6bdf4 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs @@ -118,7 +118,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 5c51f02dec47..5812ff114710 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -118,7 +118,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://localhost/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 601dfdb2f3e7..72ca7062a479 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -122,7 +122,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 601dfdb2f3e7..72ca7062a479 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -122,7 +122,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index ed3aecacd924..fff7cc8bf22a 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -117,7 +117,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; BasePath = "http://petstore.swagger.io:80/v2"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary();