File tree Expand file tree Collapse file tree
modules/openapi-generator/src/main/resources/csharp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,11 +130,17 @@ namespace {{packageName}}.Client
130130 }
131131
132132 var httpValues = HttpUtility.ParseQueryString(string.Empty);
133+ #if (NETCOREAPP)
134+ // On .NET 9+, ParseQueryString already URL-encodes values.
135+ // Skip UrlEncode to prevent double-encoding that causes signature mismatches.
136+ string framework = RuntimeInformation.FrameworkDescription;
137+ bool skipUrlEncode = framework.StartsWith(".NET ") &&
138+ int.TryParse(framework.Substring(5).Split('.')[0], out int major) && major >= 9;
139+ #endif
133140 foreach (var parameter in requestOptions.QueryParameters)
134141 {
135142#if (NETCOREAPP)
136- string framework = RuntimeInformation.FrameworkDescription;
137- string key = framework.StartsWith(" .NET 9" )?parameter.Key:HttpUtility.UrlEncode(parameter.Key);
143+ string key = skipUrlEncode ? parameter.Key : HttpUtility.UrlEncode(parameter.Key);
138144 if (parameter.Value.Count > 1)
139145 { // array
140146 foreach (var value in parameter.Value)
You can’t perform that action at this time.
0 commit comments