Skip to content

Commit

Permalink
Reformat with scalafmt 3.7.17
Browse files Browse the repository at this point in the history
Executed command: scalafmt --non-interactive
  • Loading branch information
scala-steward committed Nov 17, 2023
1 parent 456c701 commit cc4f485
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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 cc4f485

Please sign in to comment.