From f7ab94261664918432013f6f764ff6ecdb7a105d Mon Sep 17 00:00:00 2001 From: Kristian Nedrevold Date: Wed, 27 Aug 2025 13:14:38 +0200 Subject: [PATCH] Update baseClient.mustache for scala-http4s The code for setting the form body parameters were wrong, e.g. the key value pair (id, 12345) would be encoded as id=%28id%2C12345%29 This commit adds a fix to the base client to correctly setting formBody values the previous pair will now be encoded as id=12345 --- .../src/main/resources/scala-http4s/baseClient.mustache | 2 +- .../main/scala/org/openapitools/client/apis/BaseClient.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/scala-http4s/baseClient.mustache b/modules/openapi-generator/src/main/resources/scala-http4s/baseClient.mustache index b10d24f790d4..4e9e5ab2e1bf 100644 --- a/modules/openapi-generator/src/main/resources/scala-http4s/baseClient.mustache +++ b/modules/openapi-generator/src/main/resources/scala-http4s/baseClient.mustache @@ -66,7 +66,7 @@ abstract class BaseClient[F[*]: Concurrent]( request.putHeaders(Header.Raw(CIString(name), value)) } val formBody = formParameters.map { x => - UrlForm(x.groupBy(_._1).map{case (k, v) => (k, v.mkString(","))}.toSeq*) + UrlForm(x.groupBy(_._1).map { case (k, v) => (k, v.map(_._2).mkString(",")) }.toSeq*) } import JsonSupports.* diff --git a/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/apis/BaseClient.scala b/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/apis/BaseClient.scala index 8a8b663010e8..3638a6dbacf7 100644 --- a/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/apis/BaseClient.scala +++ b/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/apis/BaseClient.scala @@ -75,7 +75,7 @@ abstract class BaseClient[F[*]: Concurrent]( request.putHeaders(Header.Raw(CIString(name), value)) } val formBody = formParameters.map { x => - UrlForm(x.groupBy(_._1).map{case (k, v) => (k, v.mkString(","))}.toSeq*) + UrlForm(x.groupBy(_._1).map { case (k, v) => (k, v.map(_._2).mkString(",")) }.toSeq*) } import JsonSupports.*