diff --git a/core/src/main/scala/sttp/model/MediaType.scala b/core/src/main/scala/sttp/model/MediaType.scala index 9bdcfcd6..b674ba98 100644 --- a/core/src/main/scala/sttp/model/MediaType.scala +++ b/core/src/main/scala/sttp/model/MediaType.scala @@ -34,7 +34,8 @@ case class MediaType( (range.charset == Wildcard || charset.forall(_.equalsIgnoreCase(range.charset))) && // #309: when the main or sub types are wildcard, not taking into account the parameters // #3253 from tapir: checking the parameters only if they are present in the range - (range.mainType == Wildcard || range.subType == Wildcard || range.otherParameters.isEmpty || (range.otherParameters.size == 1 && range.otherParameters.contains("q")) || { + (range.mainType == Wildcard || range.subType == Wildcard || range.otherParameters.isEmpty || (range.otherParameters.size == 1 && range.otherParameters + .contains("q")) || { // the q value needs to be ignored - it has a different purpose val rangeParametersWithoutQ = range.otherParameters - "q" // `otherParameters` needs to be fully equal to `range.otherParameters` (ignoring case) diff --git a/core/src/test/scala/sttp/model/MediaTypeTests.scala b/core/src/test/scala/sttp/model/MediaTypeTests.scala index ebf6c9ee..df7dfdd0 100644 --- a/core/src/test/scala/sttp/model/MediaTypeTests.scala +++ b/core/src/test/scala/sttp/model/MediaTypeTests.scala @@ -69,7 +69,11 @@ class MediaTypeTests extends AnyFlatSpec with Matchers with TableDrivenPropertyC (MediaType.ApplicationJson, ContentTypeRange("application", "json", "*", EmptyParameters), true), // the q parameter in the range should be ignored (MediaType.ApplicationJson, ContentTypeRange("application", "json", "*", Map("q" -> "0.5")), true), - (MediaType.ApplicationJson.copy(otherParameters = Map("a" -> "1")), ContentTypeRange("application", "json", "*", Map("q" -> "0.5")), true), + ( + MediaType.ApplicationJson.copy(otherParameters = Map("a" -> "1")), + ContentTypeRange("application", "json", "*", Map("q" -> "0.5")), + true + ), // range defines parameters, but they are not equal (ignoring case) (MediaType.ApplicationJson, ContentTypeRange("application", "json", "*", Map("a" -> "1")), false), (