Skip to content

Commit

Permalink
Merge pull request #316 from softwaremill/update/scalafmt-core-3.7.17
Browse files Browse the repository at this point in the history
Update scalafmt-core to 3.7.17
  • Loading branch information
adamw authored Dec 21, 2023
2 parents b3917b0 + 27bdeed commit 281f551
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# Scala Steward: Reformat with scalafmt 3.7.15
f7dccf8d205c1d4f9bd5dbbf9680a6b9d175b444

# Scala Steward: Reformat with scalafmt 3.7.17
cc4f48597d3151542ecec3c159159e1793926314
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
runner.dialect = scala3
version = 3.7.15
version = 3.7.17
maxColumn = 120
3 changes: 2 additions & 1 deletion core/src/main/scala/sttp/model/MediaType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion core/src/test/scala/sttp/model/MediaTypeTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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),
(
Expand Down

0 comments on commit 281f551

Please sign in to comment.