From b933b7322d767e8c81c8a968d5800450afbbcc60 Mon Sep 17 00:00:00 2001 From: adamw Date: Wed, 2 Oct 2024 10:04:20 +0200 Subject: [PATCH] Release 3.10.0 --- README.md | 8 +-- generated-docs/out/backends/akka.md | 2 +- generated-docs/out/backends/catseffect.md | 4 +- generated-docs/out/backends/finagle.md | 2 +- generated-docs/out/backends/fs2.md | 10 ++-- generated-docs/out/backends/future.md | 10 ++-- generated-docs/out/backends/http4s.md | 4 +- .../out/backends/javascript/fetch.md | 12 ++--- generated-docs/out/backends/monix.md | 6 +-- generated-docs/out/backends/native/curl.md | 2 +- generated-docs/out/backends/pekko.md | 2 +- generated-docs/out/backends/scalaz.md | 2 +- generated-docs/out/backends/synchronous.md | 6 +-- .../out/backends/wrappers/custom.md | 6 +-- .../out/backends/wrappers/logging.md | 7 ++- .../out/backends/wrappers/opentelemetry.md | 4 +- .../out/backends/wrappers/prometheus.md | 2 +- generated-docs/out/backends/zio.md | 8 +-- generated-docs/out/conf/ssl.md | 2 +- generated-docs/out/examples.md | 54 +++++++++---------- generated-docs/out/json.md | 26 ++++----- generated-docs/out/openapi.md | 8 +-- generated-docs/out/quickstart.md | 6 +-- generated-docs/out/simple_sync.md | 4 +- generated-docs/out/testing.md | 18 ++++--- 25 files changed, 113 insertions(+), 102 deletions(-) diff --git a/README.md b/README.md index 833fedfaa1..e74c51010f 100755 --- a/README.md +++ b/README.md @@ -49,14 +49,14 @@ sttp (v2) documentation is available at [sttp.softwaremill.com/en/v2](http://stt sttp (v1) documentation is available at [sttp.softwaremill.com/en/v1](https://sttp.softwaremill.com/en/v1). -scaladoc is available at [https://www.javadoc.io](https://www.javadoc.io/doc/com.softwaremill.sttp.client3/core_2.12/3.9.8) +scaladoc is available at [https://www.javadoc.io](https://www.javadoc.io/doc/com.softwaremill.sttp.client3/core_2.12/3.10.0) ## Quickstart with Ammonite If you are an [Ammonite](http://ammonite.io) user, you can quickly start experimenting with sttp by copy-pasting the following: ```scala -import $ivy.`com.softwaremill.sttp.client3::core:3.9.8` +import $ivy.`com.softwaremill.sttp.client3::core:3.10.0` import sttp.client3.quick._ quickRequest.get(uri"http://httpbin.org/ip").send(backend) ``` @@ -68,7 +68,7 @@ This brings in the sttp API and a synchronous backend instance. Add the following dependency: ```scala -"com.softwaremill.sttp.client3" %% "core" % "3.9.8" +"com.softwaremill.sttp.client3" %% "core" % "3.10.0" ``` Then, import: @@ -123,7 +123,7 @@ The documentation is typechecked using [mdoc](https://scalameta.org/mdoc/). The 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. -That is, in sbt run: `set version := "3.9.8"`, before running `mdoc` in `docs`. +That is, in sbt run: `set version := "3.10.0"`, before running `mdoc` in `docs`. ### Testing the Scala.JS backend diff --git a/generated-docs/out/backends/akka.md b/generated-docs/out/backends/akka.md index bbb27030e4..217782ce0b 100644 --- a/generated-docs/out/backends/akka.md +++ b/generated-docs/out/backends/akka.md @@ -3,7 +3,7 @@ This backend is based on [akka-http](http://doc.akka.io/docs/akka-http/current/scala/http/). To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.9.8" +"com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.10.0" ``` A fully **asynchronous** backend. Uses the `Future` effect to return responses. There are also [other `Future`-based backends](future.md), which don't depend on Akka. diff --git a/generated-docs/out/backends/catseffect.md b/generated-docs/out/backends/catseffect.md index 12a1878ee0..305b304158 100644 --- a/generated-docs/out/backends/catseffect.md +++ b/generated-docs/out/backends/catseffect.md @@ -76,9 +76,9 @@ Creation of the backend can be done in two basic ways: Firstly, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "armeria-backend-cats" % "3.9.8" // for cats-effect 3.x +"com.softwaremill.sttp.client3" %% "armeria-backend-cats" % "3.10.0" // for cats-effect 3.x // or -"com.softwaremill.sttp.client3" %% "armeria-backend-cats-ce2" % "3.9.8" // for cats-effect 2.x +"com.softwaremill.sttp.client3" %% "armeria-backend-cats-ce2" % "3.10.0" // for cats-effect 2.x ``` create client: diff --git a/generated-docs/out/backends/finagle.md b/generated-docs/out/backends/finagle.md index 4ee1b52a61..741d32764c 100644 --- a/generated-docs/out/backends/finagle.md +++ b/generated-docs/out/backends/finagle.md @@ -3,7 +3,7 @@ To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "finagle-backend" % "3.9.8" +"com.softwaremill.sttp.client3" %% "finagle-backend" % "3.10.0" ``` Next you'll need to add an implicit value: diff --git a/generated-docs/out/backends/fs2.md b/generated-docs/out/backends/fs2.md index c77c1101c1..765a106242 100644 --- a/generated-docs/out/backends/fs2.md +++ b/generated-docs/out/backends/fs2.md @@ -12,9 +12,9 @@ Creation of the backend can be done in two basic ways: Firstly, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "fs2" % "3.9.8" // for cats-effect 3.x & fs2 3.x +"com.softwaremill.sttp.client3" %% "fs2" % "3.10.0" // for cats-effect 3.x & fs2 3.x // or -"com.softwaremill.sttp.client3" %% "fs2-ce2" % "3.9.8" // for cats-effect 2.x & fs2 2.x +"com.softwaremill.sttp.client3" %% "fs2-ce2" % "3.10.0" // for cats-effect 2.x & fs2 2.x ``` Obtain a cats-effect `Resource` which creates the backend, and closes the thread pool after the resource is no longer used: @@ -78,9 +78,9 @@ Host header override is supported in environments running Java 12 onwards, but i To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "armeria-backend-fs2" % "3.9.8" // for cats-effect 3.x & fs2 3.x +"com.softwaremill.sttp.client3" %% "armeria-backend-fs2" % "3.10.0" // for cats-effect 3.x & fs2 3.x // or -"com.softwaremill.sttp.client3" %% "armeria-backend-fs2" % "3.9.8" // for cats-effect 2.x & fs2 2.x +"com.softwaremill.sttp.client3" %% "armeria-backend-fs2" % "3.10.0" // for cats-effect 2.x & fs2 2.x ``` create client: @@ -147,6 +147,7 @@ val effect = HttpClientFs2Backend.resource[IO]().use { backend => .post(uri"...") .send(backend) } +// run the effect ``` Responses can also be streamed: @@ -169,6 +170,7 @@ val effect = HttpClientFs2Backend.resource[IO]().use { backend => response } +// run the effect ``` ## Websockets diff --git a/generated-docs/out/backends/future.md b/generated-docs/out/backends/future.md index 3e47ab273a..7faa07e1ae 100644 --- a/generated-docs/out/backends/future.md +++ b/generated-docs/out/backends/future.md @@ -20,7 +20,7 @@ Class Supported stream type To use, you don't need any extra dependencies, `core` is enough: ``` -"com.softwaremill.sttp.client3" %% "core" % "3.9.8" +"com.softwaremill.sttp.client3" %% "core" % "3.10.0" ``` You'll need the following imports: @@ -41,7 +41,7 @@ or, if you'd like to instantiate the HttpClient yourself: ```scala import java.net.http.HttpClient -val client: HttpClient = ??? +val client: HttpClient = ??? val backend = HttpClientFutureBackend.usingClient(client) ``` @@ -59,7 +59,7 @@ Host header override is supported in environments running Java 12 onwards, but i To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "okhttp-backend" % "3.9.8" +"com.softwaremill.sttp.client3" %% "okhttp-backend" % "3.10.0" ``` and some imports: @@ -80,7 +80,7 @@ or, if you'd like to instantiate the OkHttpClient yourself: ```scala import okhttp3.OkHttpClient -val okHttpClient: OkHttpClient = ??? +val okHttpClient: OkHttpClient = ??? val backend = OkHttpFutureBackend.usingClient(okHttpClient) ``` @@ -91,7 +91,7 @@ This backend depends on [OkHttp](http://square.github.io/okhttp/) and fully supp To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "armeria-backend" % "3.9.8" +"com.softwaremill.sttp.client3" %% "armeria-backend" % "3.10.0" ``` add imports: diff --git a/generated-docs/out/backends/http4s.md b/generated-docs/out/backends/http4s.md index ac7fd9f36b..8a25ff8193 100644 --- a/generated-docs/out/backends/http4s.md +++ b/generated-docs/out/backends/http4s.md @@ -3,9 +3,9 @@ This backend is based on [http4s](https://http4s.org) (client) and is **asynchronous**. To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "http4s-backend" % "3.9.8" // for cats-effect 3.x & http4s 1.0.0-Mx +"com.softwaremill.sttp.client3" %% "http4s-backend" % "3.10.0" // for cats-effect 3.x & http4s 1.0.0-Mx // or -"com.softwaremill.sttp.client3" %% "http4s-ce2-backend" % "3.9.8" // for cats-effect 2.x & http4s 0.21.x +"com.softwaremill.sttp.client3" %% "http4s-ce2-backend" % "3.10.0" // for cats-effect 2.x & http4s 0.21.x ``` The backend can be created in a couple of ways, e.g.: diff --git a/generated-docs/out/backends/javascript/fetch.md b/generated-docs/out/backends/javascript/fetch.md index 6376a89628..88da388b5e 100644 --- a/generated-docs/out/backends/javascript/fetch.md +++ b/generated-docs/out/backends/javascript/fetch.md @@ -7,7 +7,7 @@ A JavaScript backend with web socket support. Implemented using the [Fetch API]( This is the default backend, available in the main jar for JS. To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %%% "core" % "3.9.8" +"com.softwaremill.sttp.client3" %%% "core" % "3.10.0" ``` And create the backend instance: @@ -26,7 +26,7 @@ Note that `Fetch` does not pass cookies by default. If your request needs cookie To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %%% "monix" % "3.9.8" +"com.softwaremill.sttp.client3" %%% "monix" % "3.10.0" ``` And create the backend instance: @@ -40,7 +40,7 @@ val backend = FetchMonixBackend() To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %%% "zio" % "3.9.8" +"com.softwaremill.sttp.client3" %%% "zio" % "3.10.0" ``` And create the backend instance: @@ -55,13 +55,13 @@ Any effect implementing the cats-effect `Concurrent` typeclass can be used. To u your project: ``` -"com.softwaremill.sttp.client3" %%% "cats" % "3.9.8" +"com.softwaremill.sttp.client3" %%% "cats" % "3.10.0" ``` If you are on Cats Effect 2 (CE2) you will need to add the CE2 specific dependency instead: ``` -"com.softwaremill.sttp.client3" %%% "catsce2 % "3.9.8" +"com.softwaremill.sttp.client3" %%% "catsce2 % "3.10.0" ``` And create the backend instance: @@ -129,7 +129,7 @@ Streaming support is provided via `FetchMonixBackend`. Note that streaming suppo To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %%% "monix" % "3.9.8" +"com.softwaremill.sttp.client3" %%% "monix" % "3.10.0" ``` An example of streaming a response: diff --git a/generated-docs/out/backends/monix.md b/generated-docs/out/backends/monix.md index f2cbacae75..8f3d2115a4 100644 --- a/generated-docs/out/backends/monix.md +++ b/generated-docs/out/backends/monix.md @@ -12,7 +12,7 @@ Creation of the backend can be done in two basic ways: Firstly, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "monix" % "3.9.8" +"com.softwaremill.sttp.client3" %% "monix" % "3.10.0" ``` and create the backend using: @@ -50,7 +50,7 @@ Host header override is supported in environments running Java 12 onwards, but i To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "okhttp-backend-monix" % "3.9.8" +"com.softwaremill.sttp.client3" %% "okhttp-backend-monix" % "3.10.0" ``` Create the backend using: @@ -76,7 +76,7 @@ This backend depends on [OkHttp](http://square.github.io/okhttp/) and fully supp To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "armeria-backend-monix" % "3.9.8" +"com.softwaremill.sttp.client3" %% "armeria-backend-monix" % "3.10.0" ``` add imports: diff --git a/generated-docs/out/backends/native/curl.md b/generated-docs/out/backends/native/curl.md index fac622ba27..a7b0f15fa6 100644 --- a/generated-docs/out/backends/native/curl.md +++ b/generated-docs/out/backends/native/curl.md @@ -5,7 +5,7 @@ A Scala Native backend implemented using [Curl](https://github.com/curl/curl/blo To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %%% "core" % "3.9.8" +"com.softwaremill.sttp.client3" %%% "core" % "3.10.0" ``` and initialize one of the backends: diff --git a/generated-docs/out/backends/pekko.md b/generated-docs/out/backends/pekko.md index b0f4a9dff8..33cc5a483a 100644 --- a/generated-docs/out/backends/pekko.md +++ b/generated-docs/out/backends/pekko.md @@ -3,7 +3,7 @@ This backend is based on [pekko-http](https://pekko.apache.org/docs/pekko-http/current/). To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "pekko-http-backend" % "3.9.8" +"com.softwaremill.sttp.client3" %% "pekko-http-backend" % "3.10.0" ``` A fully **asynchronous** backend. Uses the `Future` effect to return responses. There are also [other `Future`-based backends](future.md), which don't depend on Pekko. diff --git a/generated-docs/out/backends/scalaz.md b/generated-docs/out/backends/scalaz.md index acccb18942..ec131405a8 100644 --- a/generated-docs/out/backends/scalaz.md +++ b/generated-docs/out/backends/scalaz.md @@ -8,7 +8,7 @@ The [Scalaz](https://github.com/scalaz/scalaz) backend is **asynchronous**. Send To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "armeria-backend-scalaz" % "3.9.8" +"com.softwaremill.sttp.client3" %% "armeria-backend-scalaz" % "3.10.0" ``` add imports: diff --git a/generated-docs/out/backends/synchronous.md b/generated-docs/out/backends/synchronous.md index 69cedbbf17..51e0517cac 100644 --- a/generated-docs/out/backends/synchronous.md +++ b/generated-docs/out/backends/synchronous.md @@ -7,7 +7,7 @@ There are several synchronous backend implementations. Sending a request using t The default **synchronous** backend. To use, you don't need any extra dependencies, `core` is enough: ``` -"com.softwaremill.sttp.client3" %% "core" % "3.9.8" +"com.softwaremill.sttp.client3" %% "core" % "3.10.0" ``` Create the backend using: @@ -40,7 +40,7 @@ Host header override is supported in environments running Java 12 onwards, but i To use, you don't need any extra dependencies, `core` is enough: ``` -"com.softwaremill.sttp.client3" %% "core" % "3.9.8" +"com.softwaremill.sttp.client3" %% "core" % "3.10.0" ``` Create the backend using: @@ -62,7 +62,7 @@ This backend supports host header override, but it has to be enabled by system p To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "okhttp-backend" % "3.9.8" +"com.softwaremill.sttp.client3" %% "okhttp-backend" % "3.10.0" ``` Create the backend using: diff --git a/generated-docs/out/backends/wrappers/custom.md b/generated-docs/out/backends/wrappers/custom.md index 7a149646e9..4dc37aa8a8 100644 --- a/generated-docs/out/backends/wrappers/custom.md +++ b/generated-docs/out/backends/wrappers/custom.md @@ -238,7 +238,7 @@ object RateLimitingSttpBackend { Implementing a new backend is made easy as the tests are published in the `core` jar file under the `tests` classifier. Simply add the follow dependencies to your `build.sbt`: ``` -"com.softwaremill.sttp.client3" %% "core" % "3.9.8" % Test classifier "tests" +"com.softwaremill.sttp.client3" %% "core" % "3.10.0" % Test classifier "tests" ``` Implement your backend and extend the `HttpTest` class: @@ -268,9 +268,9 @@ import sttp.client3.impl.cats.implicits._ from the cats integration module. The module should be available on the classpath after adding following dependency: ```scala -"com.softwaremill.sttp.client3" %% "cats" % "3.9.8" // for cats-effect 3.x +"com.softwaremill.sttp.client3" %% "cats" % "3.10.0" // for cats-effect 3.x // or -"com.softwaremill.sttp.client3" %% "catsce2" % "3.9.8" // for cats-effect 2.x +"com.softwaremill.sttp.client3" %% "catsce2" % "3.10.0" // for cats-effect 2.x ``` The object contains implicits to convert a cats `MonadError` into the sttp `MonadError`, diff --git a/generated-docs/out/backends/wrappers/logging.md b/generated-docs/out/backends/wrappers/logging.md index b0ca52a10d..7e1293dd72 100644 --- a/generated-docs/out/backends/wrappers/logging.md +++ b/generated-docs/out/backends/wrappers/logging.md @@ -28,7 +28,7 @@ Log levels can be configured when creating the `LoggingBackend`, or specified in To use the [slf4j](http://www.slf4j.org) logging backend wrapper, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "slf4j-backend" % "3.9.8" +"com.softwaremill.sttp.client3" %% "slf4j-backend" % "3.10.0" ``` There are three backend wrappers available, which log request & response information using a slf4j `Logger`. To see the logs, you'll need to use an slf4j-compatible logger implementation, e.g. [logback](http://logback.qos.ch), or use a binding, e.g. [log4j-slf4j](https://logging.apache.org/log4j/2.0/log4j-slf4j-impl/index.html). @@ -41,6 +41,9 @@ import sttp.client3.logging.slf4j.Slf4jLoggingBackend val backend = Slf4jLoggingBackend(HttpClientSyncBackend()) basicRequest.get(uri"https://httpbin.org/get").send(backend) + +// Logs: +// 21:14:23.735 [main] INFO sttp.client3.logging.slf4j.Slf4jTimingBackend - Request: GET https://httpbin.org/get, took: 0.795s, response: 200 ``` To create a customised logging backend, see the section on [custom backends](custom.md). @@ -50,5 +53,5 @@ To create a customised logging backend, see the section on [custom backends](cus To use the [scribe](https://github.com/outr/scribe) logging backend wrapper, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "scribe-backend" % "3.9.8" +"com.softwaremill.sttp.client3" %% "scribe-backend" % "3.10.0" ``` \ No newline at end of file diff --git a/generated-docs/out/backends/wrappers/opentelemetry.md b/generated-docs/out/backends/wrappers/opentelemetry.md index 64a04961a0..e9d84c7168 100644 --- a/generated-docs/out/backends/wrappers/opentelemetry.md +++ b/generated-docs/out/backends/wrappers/opentelemetry.md @@ -12,7 +12,7 @@ The backend depends only on [opentelemetry-api](https://github.com/open-telemetr following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "opentelemetry-metrics-backend" % "3.9.8" +"com.softwaremill.sttp.client3" %% "opentelemetry-metrics-backend" % "3.10.0" ``` Then an instance can be obtained as follows: @@ -53,7 +53,7 @@ OpenTelemetryMetricsBackend( To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "opentelemetry-tracing-zio-backend" % "3.9.8" // for ZIO 2.x +"com.softwaremill.sttp.client3" %% "opentelemetry-tracing-zio-backend" % "3.10.0" // for ZIO 2.x ``` This backend depends on [zio-opentelemetry](https://github.com/zio/zio-telemetry). diff --git a/generated-docs/out/backends/wrappers/prometheus.md b/generated-docs/out/backends/wrappers/prometheus.md index 61cb54d72e..5f32f16452 100644 --- a/generated-docs/out/backends/wrappers/prometheus.md +++ b/generated-docs/out/backends/wrappers/prometheus.md @@ -3,7 +3,7 @@ To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "prometheus-backend" % "3.9.8" +"com.softwaremill.sttp.client3" %% "prometheus-backend" % "3.10.0" ``` and some imports: diff --git a/generated-docs/out/backends/zio.md b/generated-docs/out/backends/zio.md index 4d18771771..0677da9de2 100644 --- a/generated-docs/out/backends/zio.md +++ b/generated-docs/out/backends/zio.md @@ -9,8 +9,8 @@ The `*-zio` modules depend on ZIO 2.x. For ZIO 1.x support, use modules with the To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "zio" % "3.9.8" // for ZIO 2.x -"com.softwaremill.sttp.client3" %% "zio1" % "3.9.8" // for ZIO 1.x +"com.softwaremill.sttp.client3" %% "zio" % "3.10.0" // for ZIO 2.x +"com.softwaremill.sttp.client3" %% "zio1" % "3.10.0" // for ZIO 1.x ``` Create the backend using: @@ -45,8 +45,8 @@ Host header override is supported in environments running Java 12 onwards, but i To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "armeria-backend-zio" % "3.9.8" // for ZIO 2.x -"com.softwaremill.sttp.client3" %% "armeria-backend-zio1" % "3.9.8" // for ZIO 1.x +"com.softwaremill.sttp.client3" %% "armeria-backend-zio" % "3.10.0" // for ZIO 2.x +"com.softwaremill.sttp.client3" %% "armeria-backend-zio1" % "3.10.0" // for ZIO 1.x ``` add imports: diff --git a/generated-docs/out/conf/ssl.md b/generated-docs/out/conf/ssl.md index 279b0039ae..ee16fb45d7 100644 --- a/generated-docs/out/conf/ssl.md +++ b/generated-docs/out/conf/ssl.md @@ -50,7 +50,7 @@ Next, based on [one way SSL example](#one-way-ssl), add `TrustManagerFactory` to ```scala ks.load(new FileInputStream("/path/to/server_trust"), "password".toCharArray) -val tmf: TrustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm) +val tmf: TrustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm) tmf.init(ks) val ssl: SSLContext = SSLContext.getInstance("TLS") diff --git a/generated-docs/out/examples.md b/generated-docs/out/examples.md index bf7cb5e6f9..583347a4f8 100644 --- a/generated-docs/out/examples.md +++ b/generated-docs/out/examples.md @@ -7,7 +7,7 @@ All of the examples are available [in the sources](https://github.com/softwaremi Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.10.0") ``` Example code: @@ -22,7 +22,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.10.0") ``` Example code: @@ -38,8 +38,8 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.9.8", - "com.softwaremill.sttp.client3" %% "json4s" % "3.9.8", + "com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.10.0", + "com.softwaremill.sttp.client3" %% "json4s" % "3.10.0", "org.json4s" %% "json4s-native" % "3.6.0" ) ``` @@ -57,9 +57,9 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client3" %% "zio" % "3.9.8", - "com.softwaremill.sttp.client3" %% "circe" % "3.9.8", - "io.circe" %% "circe-generic" % "0.14.6" + "com.softwaremill.sttp.client3" %% "zio" % "3.10.0", + "com.softwaremill.sttp.client3" %% "circe" % "3.10.0", + "io.circe" %% "circe-generic" % "0.14.10" ) ``` @@ -76,9 +76,9 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client3" %% "monix" % "3.9.8", - "com.softwaremill.sttp.client3" %% "circe" % "3.9.8", - "io.circe" %% "circe-generic" % "0.14.6" + "com.softwaremill.sttp.client3" %% "monix" % "3.10.0", + "com.softwaremill.sttp.client3" %% "circe" % "3.10.0", + "io.circe" %% "circe-generic" % "0.14.10" ) ``` @@ -95,9 +95,9 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client3" %% "slf4j-backend" % "3.9.8", - "com.softwaremill.sttp.client3" %% "circe" % "3.9.8", - "io.circe" %% "circe-generic" % "0.14.6" + "com.softwaremill.sttp.client3" %% "slf4j-backend" % "3.10.0", + "com.softwaremill.sttp.client3" %% "circe" % "3.10.0", + "io.circe" %% "circe-generic" % "0.14.10" ) ``` @@ -114,9 +114,9 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client3" %% "monix" % "3.9.8", - "com.softwaremill.sttp.client3" %% "circe" % "3.9.8", - "io.circe" %% "circe-generic" % "0.14.6" + "com.softwaremill.sttp.client3" %% "monix" % "3.10.0", + "com.softwaremill.sttp.client3" %% "circe" % "3.10.0", + "io.circe" %% "circe-generic" % "0.14.10" ) ``` @@ -132,7 +132,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.10.0") ``` Example code: @@ -146,7 +146,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "zio" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "zio" % "3.10.0") ``` Example code: @@ -161,7 +161,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "fs2" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "fs2" % "3.10.0") ``` Example code: @@ -176,7 +176,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "monix" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "monix" % "3.10.0") ``` Example code: @@ -191,7 +191,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.10.0") ``` Example code: @@ -206,7 +206,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "pekko-http-backend" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "pekko-http-backend" % "3.10.0") ``` Example code: @@ -221,7 +221,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "monix" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "monix" % "3.10.0") ``` Example code: @@ -236,7 +236,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "fs2" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "fs2" % "3.10.0") ``` Example code: @@ -251,7 +251,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "zio" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "zio" % "3.10.0") ``` Example code: @@ -266,7 +266,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "zio" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "zio" % "3.10.0") ``` Example code: @@ -281,7 +281,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.9.8") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.10.0") ``` Example code: diff --git a/generated-docs/out/json.md b/generated-docs/out/json.md index 3208f52e0b..2d0925edf1 100644 --- a/generated-docs/out/json.md +++ b/generated-docs/out/json.md @@ -34,7 +34,7 @@ case class ResponsePayload(data: String) JSON encoding of bodies and decoding of responses can be handled using [Circe](https://circe.github.io/circe/) by the `circe` module. To use add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "circe" % "3.9.8" +"com.softwaremill.sttp.client3" %% "circe" % "3.10.0" ``` This module adds a body serialized, so that json payloads can be sent as request bodies. To send a payload of type `T` as json, a `io.circe.Encoder[T]` implicit value must be available in scope. @@ -66,7 +66,7 @@ Arbitrary JSON structures can be traversed by parsing the result as `io.circe.Js To encode and decode json using json4s, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "json4s" % "3.9.8" +"com.softwaremill.sttp.client3" %% "json4s" % "3.10.0" "org.json4s" %% "json4s-native" % "3.6.0" ``` @@ -100,7 +100,7 @@ val response: Identity[Response[Either[ResponseException[String, Exception], Res To encode and decode JSON using [spray-json](https://github.com/spray/spray-json), add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "spray-json" % "3.9.8" +"com.softwaremill.sttp.client3" %% "spray-json" % "3.10.0" ``` Using this module it is possible to set request bodies and read response bodies as your custom types, using the implicitly available instances of `spray.json.JsonWriter` / `spray.json.JsonReader` or `spray.json.JsonFormat`. @@ -132,13 +132,13 @@ val response: Identity[Response[Either[ResponseException[String, Exception], Res To encode and decode JSON using [play-json](https://www.playframework.com), add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "play-json" % "3.9.8" +"com.softwaremill.sttp.client3" %% "play-json" % "3.10.0" ``` If you use older version of play (2.x.x), add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "play2-json" % "3.9.8" +"com.softwaremill.sttp.client3" %% "play2-json" % "3.10.0" ``` To use, add an import: `import sttp.client3.playJson._`. @@ -150,13 +150,13 @@ To encode and decode JSON using the high-performance [zio-json](https://zio.gith The `zio-json` module depends on ZIO 2.x. For ZIO 1.x support, use `zio1-json`. ```scala -"com.softwaremill.sttp.client3" %% "zio-json" % "3.9.8" // for ZIO 2.x -"com.softwaremill.sttp.client3" %% "zio1-json" % "3.9.8" // for ZIO 1.x +"com.softwaremill.sttp.client3" %% "zio-json" % "3.10.0" // for ZIO 2.x +"com.softwaremill.sttp.client3" %% "zio1-json" % "3.10.0" // for ZIO 1.x ``` or for ScalaJS (cross build) projects: ```scala -"com.softwaremill.sttp.client3" %%% "zio-json" % "3.9.8" // for ZIO 2.x -"com.softwaremill.sttp.client3" %%% "zio1-json" % "3.9.8" // for ZIO 1.x +"com.softwaremill.sttp.client3" %%% "zio-json" % "3.10.0" // for ZIO 2.x +"com.softwaremill.sttp.client3" %%% "zio1-json" % "3.10.0" // for ZIO 1.x ``` To use, add an import: `import sttp.client3.ziojson._` (or extend `SttpZioJsonApi`), define an implicit `JsonCodec`, or `JsonDecoder`/`JsonEncoder` for your datatype. @@ -188,13 +188,13 @@ basicRequest To encode and decode JSON using the [high(est)-performant](https://plokhotnyuk.github.io/jsoniter-scala/) [jsoniter-scala](https://github.com/plokhotnyuk/jsoniter-scala) library, one add the following dependency to your project. ```scala -"com.softwaremill.sttp.client3" %% "jsoniter" % "3.9.8" +"com.softwaremill.sttp.client3" %% "jsoniter" % "3.10.0" ``` or for ScalaJS (cross build) projects: ```scala -"com.softwaremill.sttp.client3" %%% "jsoniter" % "3.9.8" +"com.softwaremill.sttp.client3" %%% "jsoniter" % "3.10.0" ``` To use, add an import: `import sttp.client3.jsoniter._` (or extend `SttpJsonIterJsonApi`), define an implicit `JsonCodec`, or `JsonDecoder`/`JsonEncoder` for your datatype. @@ -228,13 +228,13 @@ basicRequest To encode and decode JSON using the [uPickle](https://github.com/com-lihaoyi/upickle) library, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "upickle" % "3.9.8" +"com.softwaremill.sttp.client3" %% "upickle" % "3.10.0" ``` or for ScalaJS (cross build) projects: ```scala -"com.softwaremill.sttp.client3" %%% "upickle" % "3.9.8" +"com.softwaremill.sttp.client3" %%% "upickle" % "3.10.0" ``` To use, add an import: `import sttp.client3.upicklejson._` (or extend `SttpUpickleApi`) and define an implicit `ReadWriter` (or separately `Reader` and `Writer`) for your datatype. diff --git a/generated-docs/out/openapi.md b/generated-docs/out/openapi.md index b0f456a4b5..6a20aef3bc 100644 --- a/generated-docs/out/openapi.md +++ b/generated-docs/out/openapi.md @@ -45,8 +45,8 @@ lazy val petstoreApi: Project = project openApiGeneratorName := "scala-sttp", openApiOutputDir := baseDirectory.value.name, libraryDependencies ++= Seq( - "com.softwaremill.sttp.client3" %% "core" % "3.9.8", - "com.softwaremill.sttp.client3" %% "json4s" % "3.9.8", + "com.softwaremill.sttp.client3" %% "core" % "3.10.0", + "com.softwaremill.sttp.client3" %% "json4s" % "3.10.0", "org.json4s" %% "json4s-jackson" % "3.6.8" ) ) @@ -96,8 +96,8 @@ lazy val petstoreApi: Project = project openApiOutputDir := baseDirectory.value.name, openApiIgnoreFileOverride := s"${baseDirectory.in(ThisBuild).value.getPath}/openapi-ignore-file", libraryDependencies ++= Seq( - "com.softwaremill.sttp.client3" %% "core" % "3.9.8", - "com.softwaremill.sttp.client3" %% "json4s" % "3.9.8", + "com.softwaremill.sttp.client3" %% "core" % "3.10.0", + "com.softwaremill.sttp.client3" %% "json4s" % "3.10.0", "org.json4s" %% "json4s-jackson" % "3.6.8" ), (compile in Compile) := ((compile in Compile) dependsOn openApiGenerate).value, diff --git a/generated-docs/out/quickstart.md b/generated-docs/out/quickstart.md index 5b47d446f0..21b51bb4b2 100644 --- a/generated-docs/out/quickstart.md +++ b/generated-docs/out/quickstart.md @@ -14,7 +14,7 @@ platforms, and that each has its own dedicated set of backends. The basic dependency which provides the API, together with a synchronous and `Future`-based backends, is: ```scala -"com.softwaremill.sttp.client3" %% "core" % "3.9.8" +"com.softwaremill.sttp.client3" %% "core" % "3.10.0" ``` ## Simple synchronous client @@ -26,7 +26,7 @@ If you'd like to send some requests synchronously, take a look at the [simple sy If you are an [Ammonite](https://ammonite.io) user, you can quickly start experimenting with sttp by copy-pasting the following: ```scala -import $ivy.`com.softwaremill.sttp.client3::core:3.9.8` +import $ivy.`com.softwaremill.sttp.client3::core:3.10.0` import sttp.client3.quick._ simpleHttpClient.send(quickRequest.get(uri"http://httpbin.org/ip")) ``` @@ -36,7 +36,7 @@ Importing the `quick` object has the same effect as importing `sttp.client3._`, If the default backend is for some reason insufficient, you can also use one based on OkHttp: ```scala -import $ivy.`com.softwaremill.sttp.client3::okhttp-backend:3.9.8` +import $ivy.`com.softwaremill.sttp.client3::okhttp-backend:3.10.0` import sttp.client3.okhttp.quick._ quickRequest.get(uri"http://httpbin.org/ip").send(backend) ``` diff --git a/generated-docs/out/simple_sync.md b/generated-docs/out/simple_sync.md index b6de8970b5..3552c72899 100644 --- a/generated-docs/out/simple_sync.md +++ b/generated-docs/out/simple_sync.md @@ -25,7 +25,7 @@ As an example, to integrate with the [uPickle](https://github.com/com-lihaoyi/up dependency: ```scala -"com.softwaremill.sttp.client3" %% "upickle" % "3.9.8" +"com.softwaremill.sttp.client3" %% "upickle" % "3.10.0" ``` Your code might then look as follows: @@ -62,7 +62,7 @@ Logging can be added using the [logging backend wrapper](backends/wrappers/loggi use slf4j, you'll need the following dependency: ``` -"com.softwaremill.sttp.client3" %% "slf4j-backend" % "3.9.8" +"com.softwaremill.sttp.client3" %% "slf4j-backend" % "3.10.0" ``` Then, you'll need to configure your client: diff --git a/generated-docs/out/testing.md b/generated-docs/out/testing.md index 234ec42190..e2495b69b6 100644 --- a/generated-docs/out/testing.md +++ b/generated-docs/out/testing.md @@ -24,7 +24,7 @@ import sttp.model._ import sttp.client3.testing._ import java.io.File import scala.concurrent.Future -import scala.concurrent.ExecutionContext.Implicits.global +import scala.concurrent.ExecutionContext.Implicits.global case class User(id: String) ``` @@ -44,6 +44,7 @@ val response1 = basicRequest.get(uri"http://example.org/a/b/c").send(testingBack // response1.body will be Right("Hello there") val response2 = basicRequest.post(uri"http://example.org/d/e").send(testingBackend) +// response2.code will be 500 ``` It is also possible to match requests by partial function, returning a response. E.g.: @@ -64,6 +65,7 @@ val response1 = basicRequest.get(uri"http://example.org/partial10").send(testing // response1.body will be Right(10) val response2 = basicRequest.post(uri"http://example.org/partialAda").send(testingBackend) +// response2.body will be Right("Ada") ``` ```eval_rst @@ -83,6 +85,7 @@ val testingBackend = SttpBackendStub.asynchronousFuture }) val responseFuture = basicRequest.get(uri"http://example.org").send(testingBackend) +// responseFuture will complete after 5 seconds with "OK" response ``` The returned response may also depend on the request: @@ -95,6 +98,7 @@ val testingBackend = SttpBackendStub.synchronous ) val response = basicRequest.get(uri"http://example.org").send(testingBackend) +// response.body will be Right("OK, got request sent to example.org") ``` You can define consecutive raw responses that will be served: @@ -104,9 +108,9 @@ val testingBackend: SttpBackendStub[Identity, Any] = SttpBackendStub.synchronous .whenAnyRequest .thenRespondCyclic("first", "second", "third") -basicRequest.get(uri"http://example.org").send(testingBackend) // Right("OK, first") // Right("OK, first") -basicRequest.get(uri"http://example.org").send(testingBackend) // Right("OK, second") // Right("OK, second") -basicRequest.get(uri"http://example.org").send(testingBackend) // Right("OK, third") // Right("OK, third") +basicRequest.get(uri"http://example.org").send(testingBackend) // Right("OK, first") +basicRequest.get(uri"http://example.org").send(testingBackend) // Right("OK, second") +basicRequest.get(uri"http://example.org").send(testingBackend) // Right("OK, third") basicRequest.get(uri"http://example.org").send(testingBackend) // Right("OK, first") ``` @@ -120,8 +124,8 @@ val testingBackend: SttpBackendStub[Identity, Any] = SttpBackendStub.synchronous Response("error", StatusCode.InternalServerError, "Something went wrong") ) -basicRequest.get(uri"http://example.org").send(testingBackend) // code will be 200 // code will be 200 -basicRequest.get(uri"http://example.org").send(testingBackend) // code will be 500 // code will be 500 +basicRequest.get(uri"http://example.org").send(testingBackend) // code will be 200 +basicRequest.get(uri"http://example.org").send(testingBackend) // code will be 500 basicRequest.get(uri"http://example.org").send(testingBackend) // code will be 200 ``` @@ -234,6 +238,7 @@ val response1 = basicRequest.get(uri"http://api.internal/a").send(testingBackend // response1.body will be Right("I'm a STUB") val response2 = basicRequest.post(uri"http://api.internal/b").send(testingBackend) +// response2 will be whatever a "real" network call to api.internal/b returns ``` ## Testing streams @@ -302,4 +307,5 @@ val response1 = basicRequest.get(uri"http://example.org/a/b/c").send(testingBack // response1.body will be Right("Hello there") testingBackend.allInteractions: List[(Request[_, _], Try[Response[_]])] +// the list will contain one element and can be verified in a test ``` \ No newline at end of file