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
4 changes: 2 additions & 2 deletions .scala-steward.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ updates.ignore = [
{groupId = "org.scala-lang", artifactId = "scala-compiler", version = "3."}
]
updates.pin = [
{groupId = "org.scala-lang", artifactId = "scala3-library", version = "3.3."},
{groupId = "org.scala-lang", artifactId = "scala3-library_sjs1", version = "3.3."}
{groupId = "org.scala-lang", artifactId = "scala3-library", version = "3.9."},
{groupId = "org.scala-lang", artifactId = "scala3-library_sjs1", version = "3.9."}
]
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
runner.dialect = scala213
runner.dialect = scala213source3
version = 3.11.5
maxColumn = 120
fileOverride {
Expand Down
7 changes: 4 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.softwaremill.Publish.ossPublishSettings
val scala2_12 = "2.12.21"
val scala2_13 = "2.13.18"
val scala2 = List(scala2_12, scala2_13)
val scala3 = List("3.3.8")
val scala3 = List("3.9.0")

val scalaTestVersion = "3.2.20"
val scalaTestPlusScalaCheckVersion = "3.2.20.0"
Expand All @@ -18,12 +18,13 @@ def dependenciesFor(version: String)(deps: (Option[(Long, Long)] => ModuleID)*):
val commonSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq(
organization := "com.softwaremill.sttp.model",
mimaPreviousArtifacts := Set.empty,
versionScheme := Some("semver-spec")
versionScheme := Some("semver-spec"),
scalacOptions ++= (if (ScalaArtifacts.isScala3(scalaVersion.value)) Seq.empty else Seq("-Xsource:3"))
)

val commonJvmSettings = commonSettings ++ Seq(
scalacOptions ++=
(if (ScalaArtifacts.isScala3(scalaVersion.value)) Seq("-Yfuture-lazy-vals", "-java-output-version", "11")
(if (ScalaArtifacts.isScala3(scalaVersion.value)) Seq("-java-output-version", "17")
else Seq("-release", "8")),
ideSkipProject := (scalaVersion.value != scala2_13),
libraryDependencies ++= Seq(
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/sttp/model/Uri.scala
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ case class Uri(

/** Replace path with the given path segment. */
@deprecated(message = "Use addPath, withPath or withWholePath", since = "1.2.0")
def pathSegments(s1: Segment, s2: Segment, ss: Segment*): Uri = withPathSegments(s1, s2, ss: _*)
def pathSegments(s1: Segment, s2: Segment, ss: Segment*): Uri = withPathSegments(s1 :: s2 :: ss.toList)

/** Replace path with the given path segments. */
@deprecated(message = "Use addPath, withPath or withWholePath", since = "1.2.0")
Expand Down Expand Up @@ -174,11 +174,11 @@ case class Uri(

/** Adds the given parameters to the query. */
@deprecated(message = "Use addParam or withParam", since = "1.2.0")
def params(ps: (String, String)*): Uri = addParams(ps: _*)
def params(ps: (String, String)*): Uri = addParams(ps*)

def addParam(k: String, v: String): Uri = addParams(k -> v)
def addParam(k: String, v: Option[String]): Uri = v.map(addParam(k, _)).getOrElse(this)
def addParams(ps: Map[String, String]): Uri = addParams(ps.toSeq: _*)
def addParams(ps: Map[String, String]): Uri = addParams(ps.toSeq*)
def addParams(mqp: QueryParams): Uri = {
this.copy(querySegments = querySegments ++ QuerySegment.fromQueryParams(mqp))
}
Expand All @@ -195,7 +195,7 @@ case class Uri(
def withParam(k: String, v: Option[String]): Uri = v.map(withParam(k, _)).getOrElse(this)

/** Replace query with the given parameters. */
def withParams(ps: Map[String, String]): Uri = withParams(ps.toSeq: _*)
def withParams(ps: Map[String, String]): Uri = withParams(ps.toSeq*)

/** Replace query with the given parameters. */
def withParams(mqp: QueryParams): Uri = this.copy(querySegments = QuerySegment.fromQueryParams(mqp).toList)
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 @@ -36,7 +36,7 @@ trait UriInterpolator {
* @throws IllegalArgumentException
* In case of a validation error. For a safe version, see [[Uri.parse()]].
*/
def uri(args: Any*): Uri = UriInterpolator.interpolate(sc, args: _*)
def uri(args: Any*): Uri = UriInterpolator.interpolate(sc, args*)
}
}

Expand Down Expand Up @@ -65,7 +65,7 @@ object UriInterpolator {
if (isScEmptyString && areArgsEmptyString) {
throw new IllegalArgumentException("empty string is not valid uri")
}
val tokens = tokenize(sc, args: _*)
val tokens = tokenize(sc, args*)

val (uri, leftTokens) =
builders.foldLeft((startingUri, filterNulls(tokens))) { case ((u, t), builder) =>
Expand Down Expand Up @@ -178,9 +178,9 @@ object UriInterpolator {
private object Tokenizer {

object Scheme extends Tokenizer {
private val alphabet = Set(('a' to 'z'): _*) ++ Set(('A' to 'Z'): _*)
private val alphabet = ('a' to 'z').toSet ++ ('A' to 'Z').toSet
private val firstChar = FastCharSet(alphabet)
private val nonFirstChars = FastCharSet(alphabet ++ Set(('0' to '9'): _*) ++ Set('+', '.', '-'))
private val nonFirstChars = FastCharSet(alphabet ++ ('0' to '9').toSet ++ Set('+', '.', '-'))

// This is equivalent to such regular expression "[A-Za-z][A-Za-z0-9+.-]*"
private def findPrefix(s: String): Option[String] = {
Expand Down Expand Up @@ -252,7 +252,7 @@ object UriInterpolator {
}

object Authority extends Tokenizer {
private val HexChars = FastCharSet(Set(('0' to '9'): _*) ++ Set(('a' to 'f'): _*) ++ Set(('A' to 'F'): _*) + ':')
private val HexChars = FastCharSet(('0' to '9').toSet ++ ('a' to 'f').toSet ++ ('A' to 'F').toSet + ':')

private def isIpV6Like(str: String): Boolean = {
val len = str.length()
Expand Down Expand Up @@ -626,7 +626,7 @@ object UriInterpolator {
v <- anyToStringOpt(ve)
} yield QF.KeyValue(k, v)

def seqToQueryFragments(s: Seq[_]): Vector[QF] = {
def seqToQueryFragments(s: Seq[Any]): Vector[QF] = {
s.flatMap {
case (ke, ve) => expressionPairToQueryFragment(ke, ve)
case ve => anyToStringOpt(ve).map(QF.Value(_))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ private[idn] object CIdn {
def errorMsg(rc: CInt): CString = extern

@name("idn2_free")
def free(ptr: Ptr[_]): Unit = extern
def free(ptr: Ptr[Byte]): Unit = extern
}
Loading