Skip to content

Commit 1a99da2

Browse files
authored
Merge branch 'master' into update/fs2-io-3.11.0
2 parents d86f679 + d40b8e7 commit 1a99da2

File tree

98 files changed

+1855
-903
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1855
-903
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ core/native/local.sbt
2424

2525
.metals/
2626
.bloop/
27-
project/metals.sbt
2827
.bsp/
2928
.java-version
29+
metals.sbt
3030

3131
.vscode
3232

3333
# scala-native
3434
lowered.hnir
35+
36+
work.txt

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ sttp (v2) documentation is available at [sttp.softwaremill.com/en/v2](https://st
4848

4949
sttp (v1) documentation is available at [sttp.softwaremill.com/en/v1](https://sttp.softwaremill.com/en/v1).
5050

51-
scaladoc is available at [https://www.javadoc.io](https://www.javadoc.io/doc/com.softwaremill.sttp.client4/core_2.12/4.0.0-M17)
51+
scaladoc is available at [https://www.javadoc.io](https://www.javadoc.io/doc/com.softwaremill.sttp.client4/core_2.12/4.0.0-M19)
5252

5353
## Quickstart with scala-cli
5454

5555
Add the following directive to the top of your scala file to add the core sttp dependency:
5656
If you are using [scala-cli](https://scala-cli.virtuslab.org), you can quickly start experimenting with sttp by copy-pasting the following:
5757

5858
```
59-
//> using dep "com.softwaremill.sttp.client4::core:4.0.0-M17"
59+
//> using dep "com.softwaremill.sttp.client4::core:4.0.0-M19"
6060
import sttp.client4.quick._
6161
quickRequest.get(uri"http://httpbin.org/ip").send()
6262
```
@@ -68,7 +68,7 @@ The `quick` package import brings in the sttp API and a pre-configured, global s
6868
Similarly, using [Ammonite](http://ammonite.io):
6969

7070
```scala
71-
import $ivy.`com.softwaremill.sttp.client4::core:4.0.0-M17`
71+
import $ivy.`com.softwaremill.sttp.client4::core:4.0.0-M19`
7272
import sttp.client4.quick._
7373
quickRequest.get(uri"http://httpbin.org/ip").send()
7474
```
@@ -78,7 +78,7 @@ quickRequest.get(uri"http://httpbin.org/ip").send()
7878
Add the following dependency:
7979

8080
```scala
81-
"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M17"
81+
"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M19"
8282
```
8383

8484
Then, import:
@@ -110,6 +110,8 @@ We are also always looking for contributions and new ideas, so if you’d like t
110110
Note that running the default `test` task will run the tests using both the JVM and JS backends, and is likely to run out of memory.
111111
If you'd like to run the tests using *only* the JVM backend, execute: `sbt rootJVM/test`.
112112

113+
When you have a PR ready, take a look at our ["How to prepare a good PR" guide](https://softwaremill.community/t/how-to-prepare-a-good-pr-to-a-library/448). Thanks! :)
114+
113115
### Importing into IntelliJ
114116

115117
By default, when importing to IntelliJ or Metals, only the Scala 2.13/JVM subprojects will be imported. This is controlled by the `ideSkipProject` setting in `build.sbt` (inside `commonSettings`).
@@ -133,7 +135,7 @@ The documentation is typechecked using [mdoc](https://scalameta.org/mdoc/). The
133135

134136
When generating documentation, it's best to set the version to the current one, so that the generated doc files don't include modifications with the current snapshot version.
135137

136-
That is, in sbt run: `set version := "4.0.0-M17"`, before running `mdoc` in `docs`.
138+
That is, in sbt run: `set version := "4.0.0-M19"`, before running `mdoc` in `docs`.
137139

138140
### Testing the Scala.JS backend
139141

akka-http-backend/src/main/scala/sttp/client4/akkahttp/BodyFromAkka.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private[akkahttp] class BodyFromAkka()(implicit ec: ExecutionContext, mat: Mater
4747
override protected def regularAsByteArray(response: HttpResponse): Future[Array[Byte]] =
4848
response.entity.dataBytes
4949
.runFold(ByteString(""))(_ ++ _)
50-
.map(_.toArray[Byte])
50+
.map(_.toArrayUnsafe())
5151

5252
override protected def regularAsFile(response: HttpResponse, file: SttpFile): Future[SttpFile] = {
5353
val f = file.toFile
@@ -203,13 +203,13 @@ private[akkahttp] class BodyFromAkka()(implicit ec: ExecutionContext, mat: Mater
203203
case msg: TextMessage =>
204204
msg.textStream.runFold("")(_ + _).map(t => WebSocketFrame.text(t))
205205
case msg: BinaryMessage =>
206-
msg.dataStream.runFold(ByteString.empty)(_ ++ _).map(b => WebSocketFrame.binary(b.toArray))
206+
msg.dataStream.runFold(ByteString.empty)(_ ++ _).map(b => WebSocketFrame.binary(b.toArrayUnsafe()))
207207
}
208208

209209
private def frameToMessage(w: WebSocketFrame): Option[Message] =
210210
w match {
211211
case WebSocketFrame.Text(p, _, _) => Some(TextMessage(p))
212-
case WebSocketFrame.Binary(p, _, _) => Some(BinaryMessage(ByteString(p)))
212+
case WebSocketFrame.Binary(p, _, _) => Some(BinaryMessage(ByteString.fromArrayUnsafe(p)))
213213
case WebSocketFrame.Ping(_) => None
214214
case WebSocketFrame.Pong(_) => None
215215
case WebSocketFrame.Close(_, _) => throw WebSocketClosed(None)

async-http-client-backend/zio/src/test/scala/sttp/client4/asynchttpclient/zio/AsyncHttpClientZioHttpTest.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package sttp.client4.asynchttpclient.zio
33
import sttp.client4._
44
import sttp.client4.asynchttpclient.AsyncHttpClientHttpTest
55
import sttp.client4.impl.zio.ZioTestBase
6-
import sttp.client4.testing.{ConvertToFuture, HttpTest}
7-
import zio.{Task, ZIO}
6+
import sttp.client4.testing.ConvertToFuture
7+
import zio.Task
8+
import zio.ZIO
89

910
class AsyncHttpClientZioHttpTest extends AsyncHttpClientHttpTest[Task] with ZioTestBase {
1011

build.sbt

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import complete.DefaultParsers._
88
// run JS tests inside Chrome, due to jsdom not supporting fetch
99
import com.softwaremill.SbtSoftwareMillBrowserTestJS._
1010

11-
val scala2_12 = "2.12.19"
12-
val scala2_13 = "2.13.14"
11+
val scala2_12 = "2.12.20"
12+
val scala2_13 = "2.13.15"
1313
val scala2 = List(scala2_12, scala2_13)
14-
val scala3 = List("3.3.3")
14+
val scala3 = List("3.3.4")
1515

1616
lazy val testServerPort = settingKey[Int]("Port to run the http test server on")
1717
lazy val startTestServer = taskKey[Unit]("Start a http server used by tests")
@@ -118,15 +118,15 @@ val testServerSettings = Seq(
118118
}
119119
)
120120

121-
val circeVersion: String = "0.14.9"
121+
val circeVersion: String = "0.14.10"
122122

123-
val jsoniterVersion = "2.30.8"
123+
val jsoniterVersion = "2.31.3"
124124

125125
val play29JsonVersion = "2.10.6"
126126

127127
val playJsonVersion = "3.0.4"
128128

129-
val catsEffect_3_version = "3.5.4"
129+
val catsEffect_3_version = "3.5.7"
130130
val fs2_3_version = "3.11.0"
131131

132132
val catsEffect_2_version = "2.5.5"
@@ -137,35 +137,35 @@ val akkaHttp = "com.typesafe.akka" %% "akka-http" % "10.2.10"
137137
val akkaStreamVersion = "2.6.20"
138138
val akkaStreams = "com.typesafe.akka" %% "akka-stream" % akkaStreamVersion
139139

140-
val pekkoHttp = "org.apache.pekko" %% "pekko-http" % "1.0.1"
141-
val pekkoStreamVersion = "1.0.3"
140+
val pekkoHttp = "org.apache.pekko" %% "pekko-http" % "1.1.0"
141+
val pekkoStreamVersion = "1.1.2"
142142
val pekkoStreams = "org.apache.pekko" %% "pekko-stream" % pekkoStreamVersion
143143

144144
val scalaTest = libraryDependencies ++= Seq("freespec", "funsuite", "flatspec", "wordspec", "shouldmatchers").map(m =>
145145
"org.scalatest" %%% s"scalatest-$m" % "3.2.19" % Test
146146
)
147147

148148
val zio1Version = "1.0.18"
149-
val zio2Version = "2.1.8"
149+
val zio2Version = "2.1.13"
150150
val zio1InteropRsVersion = "1.3.12"
151151
val zio2InteropRsVersion = "2.0.2"
152152

153-
val oxVersion = "0.2.0"
153+
val oxVersion = "0.5.1"
154154
val sttpModelVersion = "1.7.11"
155-
val sttpSharedVersion = "1.3.20"
155+
val sttpSharedVersion = "1.4.2"
156156

157-
val logback = "ch.qos.logback" % "logback-classic" % "1.5.7"
157+
val logback = "ch.qos.logback" % "logback-classic" % "1.5.12"
158158

159159
val jaegerClientVersion = "1.8.1"
160160
val braveOpentracingVersion = "1.0.1"
161-
val zipkinSenderOkHttpVersion = "3.4.0"
161+
val zipkinSenderOkHttpVersion = "3.4.3"
162162
val resilience4jVersion = "2.2.0"
163163
val http4s_ce2_version = "0.22.15"
164-
val http4s_ce3_version = "0.23.27"
164+
val http4s_ce3_version = "0.23.30"
165165

166-
val tethysVersion = "0.28.4"
166+
val tethysVersion = "0.29.3"
167167

168-
val openTelemetryVersion = "1.41.0"
168+
val openTelemetryVersion = "1.45.0"
169169

170170
val compileAndTest = "compile->compile;test->test"
171171

@@ -708,8 +708,8 @@ lazy val http4sBackend = (projectMatrix in file("http4s-backend"))
708708
name := "http4s-backend",
709709
libraryDependencies ++= Seq(
710710
"org.http4s" %% "http4s-client" % http4s_ce3_version,
711-
"org.http4s" %% "http4s-ember-client" % "0.23.27" % Optional,
712-
"org.http4s" %% "http4s-blaze-client" % "0.23.16" % Optional
711+
"org.http4s" %% "http4s-ember-client" % "0.23.30" % Optional,
712+
"org.http4s" %% "http4s-blaze-client" % "0.23.17" % Optional
713713
),
714714
evictionErrorLevel := Level.Info
715715
)
@@ -734,7 +734,7 @@ lazy val armeriaBackend = (projectMatrix in file("armeria-backend"))
734734
.settings(testServerSettings)
735735
.settings(
736736
name := "armeria-backend",
737-
libraryDependencies += "com.linecorp.armeria" % "armeria" % "1.30.0"
737+
libraryDependencies += "com.linecorp.armeria" % "armeria" % "1.31.3"
738738
)
739739
.jvmPlatform(scalaVersions = scala2 ++ scala3)
740740
.dependsOn(core % compileAndTest)
@@ -800,7 +800,8 @@ lazy val armeriaZioBackend =
800800
//----- json
801801
lazy val jsonCommon = (projectMatrix in (file("json/common")))
802802
.settings(
803-
name := "json-common"
803+
name := "json-common",
804+
scalaTest
804805
)
805806
.jvmPlatform(
806807
scalaVersions = scala2 ++ scala3,
@@ -826,7 +827,7 @@ lazy val circe = (projectMatrix in file("json/circe"))
826827
)
827828
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
828829
.nativePlatform(scalaVersions = scala2 ++ scala3, settings = commonNativeSettings)
829-
.dependsOn(core, jsonCommon)
830+
.dependsOn(core, jsonCommon % compileAndTest)
830831

831832
lazy val jsoniter = (projectMatrix in file("json/jsoniter"))
832833
.settings(
@@ -842,13 +843,13 @@ lazy val jsoniter = (projectMatrix in file("json/jsoniter"))
842843
settings = commonJvmSettings
843844
)
844845
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
845-
.dependsOn(core, jsonCommon)
846+
.dependsOn(core, jsonCommon % compileAndTest)
846847

847848
lazy val zioJson = (projectMatrix in file("json/zio-json"))
848849
.settings(
849850
name := "zio-json",
850851
libraryDependencies ++= Seq(
851-
"dev.zio" %%% "zio-json" % "0.7.2",
852+
"dev.zio" %%% "zio-json" % "0.7.3",
852853
"com.softwaremill.sttp.shared" %%% "zio" % sttpSharedVersion
853854
),
854855
scalaTest
@@ -858,7 +859,7 @@ lazy val zioJson = (projectMatrix in file("json/zio-json"))
858859
settings = commonJvmSettings
859860
)
860861
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
861-
.dependsOn(core, jsonCommon)
862+
.dependsOn(core, jsonCommon % compileAndTest)
862863

863864
lazy val zio1Json = (projectMatrix in file("json/zio1-json"))
864865
.settings(
@@ -874,7 +875,7 @@ lazy val zio1Json = (projectMatrix in file("json/zio1-json"))
874875
settings = commonJvmSettings
875876
)
876877
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
877-
.dependsOn(core, jsonCommon)
878+
.dependsOn(core, jsonCommon % compileAndTest)
878879

879880
lazy val tethysJson = (projectMatrix in file("json/tethys-json"))
880881
.settings(
@@ -890,7 +891,7 @@ lazy val tethysJson = (projectMatrix in file("json/tethys-json"))
890891
scalaVersions = scala2 ++ scala3,
891892
settings = commonJvmSettings
892893
)
893-
.dependsOn(core, jsonCommon)
894+
.dependsOn(core, jsonCommon % compileAndTest)
894895

895896
lazy val upickle = (projectMatrix in file("json/upickle"))
896897
.settings(
@@ -908,7 +909,7 @@ lazy val upickle = (projectMatrix in file("json/upickle"))
908909
)
909910
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
910911
.nativePlatform(scalaVersions = scala2 ++ scala3, settings = commonNativeSettings)
911-
.dependsOn(core, jsonCommon)
912+
.dependsOn(core, jsonCommon % compileAndTest)
912913

913914
lazy val json4sVersion = "4.0.7"
914915

@@ -923,7 +924,7 @@ lazy val json4s = (projectMatrix in file("json/json4s"))
923924
scalaTest
924925
)
925926
.jvmPlatform(scalaVersions = scala2 ++ scala3)
926-
.dependsOn(core, jsonCommon)
927+
.dependsOn(core, jsonCommon % compileAndTest)
927928

928929
lazy val sprayJson = (projectMatrix in file("json/spray-json"))
929930
.settings(commonJvmSettings)
@@ -935,7 +936,7 @@ lazy val sprayJson = (projectMatrix in file("json/spray-json"))
935936
scalaTest
936937
)
937938
.jvmPlatform(scalaVersions = scala2 ++ scala3)
938-
.dependsOn(core, jsonCommon)
939+
.dependsOn(core, jsonCommon % compileAndTest)
939940

940941
lazy val play29Json = (projectMatrix in file("json/play29-json"))
941942
.settings(
@@ -952,7 +953,7 @@ lazy val play29Json = (projectMatrix in file("json/play29-json"))
952953
settings = commonJvmSettings
953954
)
954955
.jsPlatform(scalaVersions = scala2, settings = commonJsSettings)
955-
.dependsOn(core, jsonCommon)
956+
.dependsOn(core, jsonCommon % compileAndTest)
956957

957958
lazy val playJson = (projectMatrix in file("json/play-json"))
958959
.settings(
@@ -967,14 +968,14 @@ lazy val playJson = (projectMatrix in file("json/play-json"))
967968
settings = commonJvmSettings
968969
)
969970
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
970-
.dependsOn(core, jsonCommon)
971+
.dependsOn(core, jsonCommon % compileAndTest)
971972

972973
lazy val prometheusBackend = (projectMatrix in file("observability/prometheus-backend"))
973974
.settings(commonJvmSettings)
974975
.settings(
975976
name := "prometheus-backend",
976977
libraryDependencies ++= Seq(
977-
"io.prometheus" % "prometheus-metrics-core" % "1.3.1"
978+
"io.prometheus" % "prometheus-metrics-core" % "1.3.4"
978979
),
979980
scalaTest
980981
)
@@ -999,7 +1000,7 @@ lazy val openTelemetryTracingZioBackend = (projectMatrix in file("observability/
9991000
.settings(
10001001
name := "opentelemetry-tracing-zio-backend",
10011002
libraryDependencies ++= Seq(
1002-
"dev.zio" %% "zio-opentelemetry" % "3.0.0-RC26",
1003+
"dev.zio" %% "zio-opentelemetry" % "3.1.0",
10031004
"io.opentelemetry.semconv" % "opentelemetry-semconv" % "1.26.0-alpha",
10041005
"io.opentelemetry" % "opentelemetry-api" % openTelemetryVersion,
10051006
"io.opentelemetry" % "opentelemetry-sdk-testing" % openTelemetryVersion % Test
@@ -1014,7 +1015,7 @@ lazy val scribeBackend = (projectMatrix in file("logging/scribe"))
10141015
.settings(
10151016
name := "scribe-backend",
10161017
libraryDependencies ++= Seq(
1017-
"com.outr" %%% "scribe" % "3.15.0"
1018+
"com.outr" %%% "scribe" % "3.15.2"
10181019
),
10191020
scalaTest
10201021
)
@@ -1118,7 +1119,7 @@ lazy val docs: ProjectMatrix = (projectMatrix in file("generated-docs")) // impo
11181119
"org.json4s" %% "json4s-native" % json4sVersion,
11191120
"io.circe" %% "circe-generic" % circeVersion,
11201121
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion,
1121-
"commons-io" % "commons-io" % "2.16.1",
1122+
"commons-io" % "commons-io" % "2.18.0",
11221123
"io.github.resilience4j" % "resilience4j-circuitbreaker" % resilience4jVersion,
11231124
"io.github.resilience4j" % "resilience4j-ratelimiter" % resilience4jVersion,
11241125
"io.jaegertracing" % "jaeger-client" % jaegerClientVersion,
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
package sttp.client4
22

33
import scala.concurrent.duration.Duration
4+
import sttp.model.HttpVersion
5+
import sttp.client4.logging.LoggingOptions
46

7+
/** Options for a [[Request]]. The defaults can be found on [[emptyRequest]]. */
58
case class RequestOptions(
69
followRedirects: Boolean,
7-
readTimeout: Duration, // TODO: Use FiniteDuration while migrating to sttp-4
10+
readTimeout: Duration,
811
maxRedirects: Int,
9-
redirectToGet: Boolean
12+
redirectToGet: Boolean,
13+
disableAutoDecompression: Boolean,
14+
httpVersion: Option[HttpVersion],
15+
loggingOptions: LoggingOptions
1016
)

0 commit comments

Comments
 (0)