Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ cc4f48597d3151542ecec3c159159e1793926314

# Scala Steward: Reformat with scalafmt 3.8.2
60f546bd54981b54826a07f290b287cd105d6a9a

# Scala Steward: Reformat with scalafmt 3.9.10
150b63917599ee04272be6fa22f8747380f952ab
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
runner.dialect = scala213
version = 3.9.4
version = 3.9.10
maxColumn = 120
fileOverride {
"glob:**/scala-3/**" {
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/scala/sttp/model/UriInterpolator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ object UriInterpolator {
case object Scheme extends UriBuilder {
override def fromTokens(u: Uri, t: ArrayView[Token]): (Uri, ArrayView[Token]) = {
split(t, SchemeEnd) match {
case Left(_) => (u, t)
case Left(_) => (u, t)
case Right((schemeTokens, _, otherTokens)) =>
val scheme = tokensToString(schemeTokens)
(u.scheme(scheme), otherTokens)
Expand All @@ -476,7 +476,7 @@ object UriInterpolator {
case object UserInfo extends UriBuilder {
override def fromTokens(u: Uri, t: ArrayView[Token]): (Uri, ArrayView[Token]) = {
split(t, AtInAuthority) match {
case Left(tt) => (u, tt)
case Left(tt) => (u, tt)
case Right((uiTokens, _, otherTokens)) =>
(uiFromTokens(u, uiTokens), otherTokens)
}
Expand All @@ -488,7 +488,7 @@ object UriInterpolator {
case x => x
}
split(uiTokensWithDots, ColonInAuthority) match {
case Left(tt) => uiFromTokens(u, tt, ArrayView.empty)
case Left(tt) => uiFromTokens(u, tt, ArrayView.empty)
case Right((usernameTokens, _, passwordTokens)) =>
uiFromTokens(u, usernameTokens, passwordTokens)
}
Expand Down Expand Up @@ -546,7 +546,7 @@ object UriInterpolator {
}

split(hpTokens, ColonInAuthority) match {
case Left(tt) => hostFromTokens(u, tt)
case Left(tt) => hostFromTokens(u, tt)
case Right((hostTokens, _, portTokens)) =>
portFromTokens(hostFromTokens(u, hostTokens), portTokens)
}
Expand Down Expand Up @@ -640,7 +640,7 @@ object UriInterpolator {
seqToQueryFragments(e)
case Left(Singleton(ExpressionToken(mqp: QueryParams))) =>
QF.fromQueryParams(mqp).toVector
case Left(t) => tokensToStringOpt(t, decodePlusAsSpace = true).map(QF.Value(_)).toVector
case Left(t) => tokensToStringOpt(t, decodePlusAsSpace = true).map(QF.Value(_)).toVector
case Right((leftEq, _, rightEq)) =>
tokensToStringOpt(leftEq, decodePlusAsSpace = true) match {
case Some(k) =>
Expand Down Expand Up @@ -799,7 +799,7 @@ object UriInterpolator {
def doSplit(vv: ArrayView[T]): Unit = {
vv.indexOf(sep) match {
case -1 => b += vv
case i => {
case i => {
b += vv.take(i)
doSplit(vv.drop(i + 1))
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/sttp/model/headers/AcceptEncoding.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object AcceptEncoding {
else {
@tailrec
def go(es: List[WeightedEncoding], validated: List[WeightedEncoding]): Either[String, AcceptEncoding] = es match {
case Nil => Right(AcceptEncoding(validated.reverse))
case Nil => Right(AcceptEncoding(validated.reverse))
case head :: tail =>
validate(head, str) match {
case Left(s) => Left(s)
Expand All @@ -38,7 +38,7 @@ object AcceptEncoding {

private def parsSingleEncoding(s: String): WeightedEncoding =
s.split(";") match {
case Array(algorithm) => WeightedEncoding(algorithm, None)
case Array(algorithm) => WeightedEncoding(algorithm, None)
case Array(algorithm, weight) =>
weight.split("=") match {
case Array(_, value) => WeightedEncoding(algorithm, Some(BigDecimal(value)))
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/sttp/model/headers/Accepts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object Accepts {
case (Nil, Nil) => AnyRange :: Nil
case (Nil, (ch, _) :: Nil) => ContentTypeRange(Wildcard, Wildcard, ch, EmptyParameters) :: Nil
case ((mt, _) :: Nil, Nil) => ContentTypeRange(mt.mainType, mt.subType, Wildcard, mt.otherParameters) :: Nil
case (Nil, chs) =>
case (Nil, chs) =>
chs.sortBy({ case (_, q) => -q }).map { case (ch, _) =>
ContentTypeRange(Wildcard, Wildcard, ch, EmptyParameters)
}
Expand All @@ -44,7 +44,7 @@ object Accepts {
chs.map { case (ch, chQ) => (mt, ch) -> math.min(mtQ, chQ) }
} match {
case ((mt, ch), _) :: Nil => ContentTypeRange(mt.mainType, mt.subType, ch, mt.otherParameters) :: Nil
case merged =>
case merged =>
merged.sortBy({ case (_, q) => -q }).map { case ((mt, ch), _) =>
ContentTypeRange(mt.mainType, mt.subType, ch, mt.otherParameters)
}
Expand Down Expand Up @@ -74,7 +74,7 @@ object Accepts {
val chs = List.newBuilder[(String, Float)]
extractEntries(headers, HeaderNames.AcceptCharset).foreach { entry =>
parseAcceptCharsetEntry(entry) match {
case Right(ch) => chs += ch
case Right(ch) => chs += ch
case Left(error) =>
if (errors.length != 0) errors.append('\n')
else ()
Expand Down Expand Up @@ -115,7 +115,7 @@ object Accepts {

private def qValueFrom(parameters: Map[String, String]): Either[String, Float] =
parameters.get("q") match {
case None => Right(1f)
case None => Right(1f)
case Some(q) =>
val qValue = Patterns.QValue.matcher(q)
if (qValue.matches() && qValue.groupCount() == 1) Right(qValue.group(1).toFloat)
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/sttp/model/headers/CacheDirective.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ object CacheDirective {
case "public" => Right(Public)
case "private" => Right(Private)
case "proxy-revalidate" => Right(ProxyRevalidate)
case SMaxagePattern(c) =>
case SMaxagePattern(c) =>
ParseUtils.toIntOption(c).map(s => SMaxage(s.seconds)).toRight("Unable to parse string: %s".format(c))
case "immutable" => Right(Immutable)
case "immutable" => Right(Immutable)
case StaleWhileRevalidatePattern(c) =>
ParseUtils
.toIntOption(c)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/sttp/model/headers/ContentRange.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object ContentRange {

private def processString(unit: String, possibleRange: String, possibleSize: String): Either[String, ContentRange] = {
val range = possibleRange.split("-") match {
case Array("*") => Right(None)
case Array("*") => Right(None)
case Array(s, e) =>
for {
start <- ParseUtils.toLongOption(s).toRight(s"Invalid start of range: $s")
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/sttp/model/headers/Cookie.scala
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ object CookieWithMeta {
case Success(maxAge) => result = result.map(_.maxAge(Some(maxAge)))
case Failure(_) => result = Left(s"Max-Age cookie directive is not a number: $v")
}
case (ci"domain", v) => result = result.map(_.domain(Some(v.getOrElse(""))))
case (ci"path", v) => result = result.map(_.path(Some(v.getOrElse(""))))
case (ci"secure", _) => result = result.map(_.secure(true))
case (ci"httponly", _) => result = result.map(_.httpOnly(true))
case (ci"domain", v) => result = result.map(_.domain(Some(v.getOrElse(""))))
case (ci"path", v) => result = result.map(_.path(Some(v.getOrElse(""))))
case (ci"secure", _) => result = result.map(_.secure(true))
case (ci"httponly", _) => result = result.map(_.httpOnly(true))
case (ci"samesite", Some(v)) =>
v.trim match {
case ci"lax" => result = result.map(_.sameSite(Some(SameSite.Lax)))
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/sttp/model/headers/Range.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object Range {
@tailrec
def run(raw: List[String], acc: List[Range]): Either[String, List[Range]] = {
raw match {
case Nil => Right(acc.reverse)
case Nil => Right(acc.reverse)
case head :: tail =>
parseSingleRange(head, unit) match {
case Right(r) => run(tail, r :: acc)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/sttp/model/internal/Validate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object Validate {
e
} match {
case Some(e) => Left(e)
case None =>
case None =>
Right(results.collect { case Right(c) =>
c
})
Expand Down