From e07f6bc690f69c1a92cd03f96a7e5cfe98b7ebd5 Mon Sep 17 00:00:00 2001 From: kciesielski Date: Fri, 26 Apr 2024 16:51:57 +0200 Subject: [PATCH] Release 4.0.0-M13 --- README.md | 10 ++-- generated-docs/out/backends/akka.md | 2 +- generated-docs/out/backends/catseffect.md | 6 +-- generated-docs/out/backends/finagle.md | 2 +- generated-docs/out/backends/fs2.md | 8 ++-- generated-docs/out/backends/future.md | 6 +-- 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/summary.md | 2 + generated-docs/out/backends/synchronous.md | 6 +-- .../out/backends/wrappers/custom.md | 6 +-- .../out/backends/wrappers/logging.md | 4 +- .../out/backends/wrappers/opentelemetry.md | 4 +- .../out/backends/wrappers/prometheus.md | 2 +- generated-docs/out/backends/zio.md | 8 ++-- generated-docs/out/examples.md | 46 +++++++++---------- generated-docs/out/json.md | 26 +++++------ generated-docs/out/openapi.md | 8 ++-- generated-docs/out/quickstart.md | 10 ++-- generated-docs/out/requests/headers.md | 9 ++-- generated-docs/out/testing.md | 12 ++--- 25 files changed, 105 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index 99b7d3972d..c065a65239 100755 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ sttp (v2) documentation is available at [sttp.softwaremill.com/en/v2](https://st 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.client4/core_2.12/4.0.0-M12) +scaladoc is available at [https://www.javadoc.io](https://www.javadoc.io/doc/com.softwaremill.sttp.client4/core_2.12/4.0.0-M13) ## Quickstart with scala-cli @@ -56,7 +56,7 @@ Add the following directive to the top of your scala file to add the core sttp d If you are using [scala-cli](https://scala-cli.virtuslab.org), you can quickly start experimenting with sttp by copy-pasting the following: ``` -//> using dep "com.softwaremill.sttp.client4::core:4.0.0-M12" +//> using dep "com.softwaremill.sttp.client4::core:4.0.0-M13" import sttp.client4.quick._ quickRequest.get(uri"http://httpbin.org/ip").send() ``` @@ -68,7 +68,7 @@ The `quick` package import brings in the sttp API and a pre-configured, global s Similarly, using [Ammonite](http://ammonite.io): ```scala -import $ivy.`com.softwaremill.sttp.client4::core:4.0.0-M12` +import $ivy.`com.softwaremill.sttp.client4::core:4.0.0-M13` import sttp.client4.quick._ quickRequest.get(uri"http://httpbin.org/ip").send() ``` @@ -78,7 +78,7 @@ quickRequest.get(uri"http://httpbin.org/ip").send() Add the following dependency: ```scala -"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13" ``` Then, import: @@ -133,7 +133,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 := "4.0.0-M12"`, before running `mdoc` in `docs`. +That is, in sbt run: `set version := "4.0.0-M13"`, 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 536570a51d..eef86e703c 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.client4" %% "akka-http-backend" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "akka-http-backend" % "4.0.0-M13" ``` 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 89262b1c8e..ca1cdffec2 100644 --- a/generated-docs/out/backends/catseffect.md +++ b/generated-docs/out/backends/catseffect.md @@ -14,7 +14,7 @@ Also note that the [http4s](http4s.md) backend can also be created for a type im Firstly, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client4" %% "cats" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "cats" % "4.0.0-M13" ``` Obtain a cats-effect `Resource` which creates the backend, and closes the thread pool after the resource is no longer used: @@ -82,9 +82,9 @@ Creation of the backend can be done in two basic ways: Firstly, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client4" %% "armeria-backend-cats" % "4.0.0-M12" // for cats-effect 3.x +"com.softwaremill.sttp.client4" %% "armeria-backend-cats" % "4.0.0-M13" // for cats-effect 3.x // or -"com.softwaremill.sttp.client4" %% "armeria-backend-cats-ce2" % "4.0.0-M12" // for cats-effect 2.x +"com.softwaremill.sttp.client4" %% "armeria-backend-cats-ce2" % "4.0.0-M13" // for cats-effect 2.x ``` create client: diff --git a/generated-docs/out/backends/finagle.md b/generated-docs/out/backends/finagle.md index 4d6b544e1b..0bc4f4660d 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.client4" %% "finagle-backend" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "finagle-backend" % "4.0.0-M13" ``` 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 192de70268..6af3f581b7 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.client4" %% "fs2" % "4.0.0-M12" // for cats-effect 3.x & fs2 3.x +"com.softwaremill.sttp.client4" %% "fs2" % "4.0.0-M13" // for cats-effect 3.x & fs2 3.x // or -"com.softwaremill.sttp.client4" %% "fs2ce2" % "4.0.0-M12" // for cats-effect 2.x & fs2 2.x +"com.softwaremill.sttp.client4" %% "fs2ce2" % "4.0.0-M13" // 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.client4" %% "armeria-backend-fs2" % "4.0.0-M12" // for cats-effect 3.x & fs2 3.x +"com.softwaremill.sttp.client4" %% "armeria-backend-fs2" % "4.0.0-M13" // for cats-effect 3.x & fs2 3.x // or -"com.softwaremill.sttp.client4" %% "armeria-backend-fs2" % "4.0.0-M12" // for cats-effect 2.x & fs2 2.x +"com.softwaremill.sttp.client4" %% "armeria-backend-fs2" % "4.0.0-M13" // for cats-effect 2.x & fs2 2.x ``` create client: diff --git a/generated-docs/out/backends/future.md b/generated-docs/out/backends/future.md index cdc4aaeb3b..69d03b4bcc 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.client4" %% "core" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13" ``` You'll need the following imports: @@ -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.client4" %% "okhttp-backend" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "okhttp-backend" % "4.0.0-M13" ``` and some imports: @@ -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.client4" %% "armeria-backend" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "armeria-backend" % "4.0.0-M13" ``` add imports: diff --git a/generated-docs/out/backends/http4s.md b/generated-docs/out/backends/http4s.md index 93957184e2..274ea96169 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.client4" %% "http4s-backend" % "4.0.0-M12" // for cats-effect 3.x & http4s 1.0.0-Mx +"com.softwaremill.sttp.client4" %% "http4s-backend" % "4.0.0-M13" // for cats-effect 3.x & http4s 1.0.0-Mx // or -"com.softwaremill.sttp.client4" %% "http4s-ce2-backend" % "4.0.0-M12" // for cats-effect 2.x & http4s 0.21.x +"com.softwaremill.sttp.client4" %% "http4s-ce2-backend" % "4.0.0-M13" // 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 c200b40334..e7dc973ad2 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.client4" %%% "core" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %%% "core" % "4.0.0-M13" ``` 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.client4" %%% "monix" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %%% "monix" % "4.0.0-M13" ``` And create the backend instance: @@ -40,7 +40,7 @@ val backend = FetchMonixBackend() To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client4" %%% "zio" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %%% "zio" % "4.0.0-M13" ``` 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.client4" %%% "cats" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %%% "cats" % "4.0.0-M13" ``` If you are on Cats Effect 2 (CE2) you will need to add the CE2 specific dependency instead: ``` -"com.softwaremill.sttp.client4" %%% "catsce2 % "4.0.0-M12" +"com.softwaremill.sttp.client4" %%% "catsce2 % "4.0.0-M13" ``` 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.client4" %%% "monix" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %%% "monix" % "4.0.0-M13" ``` An example of streaming a response: diff --git a/generated-docs/out/backends/monix.md b/generated-docs/out/backends/monix.md index 0a36fcf6ff..2a867f61aa 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.client4" %% "monix" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "monix" % "4.0.0-M13" ``` 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.client4" %% "okhttp-backend-monix" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "okhttp-backend-monix" % "4.0.0-M13" ``` 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.client4" %% "armeria-backend-monix" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "armeria-backend-monix" % "4.0.0-M13" ``` add imports: diff --git a/generated-docs/out/backends/native/curl.md b/generated-docs/out/backends/native/curl.md index 7399cf44c2..c82fcbf45a 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.client4" %%% "core" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %%% "core" % "4.0.0-M13" ``` and initialize one of the backends: diff --git a/generated-docs/out/backends/pekko.md b/generated-docs/out/backends/pekko.md index a87fb3c6ab..2930d09052 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.client4" %% "pekko-http-backend" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "pekko-http-backend" % "4.0.0-M13" ``` 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 0c9b2ed34c..6d6f5a981f 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.client4" %% "armeria-backend-scalaz" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "armeria-backend-scalaz" % "4.0.0-M13" ``` add imports: diff --git a/generated-docs/out/backends/summary.md b/generated-docs/out/backends/summary.md index 19f6a90c6f..bc6503be65 100644 --- a/generated-docs/out/backends/summary.md +++ b/generated-docs/out/backends/summary.md @@ -20,6 +20,7 @@ Which one to choose? * for simple exploratory requests, use the [synchronous](synchronous.md) `DefaultSyncBackend` / `HttpClientSyncBackend`. * if you have Akka in your stack, use the [Akka backend](akka.md) +* if you have Pekko in your stack, use the [Pekko backend](pekko.md) * if you are using `Future` without Akka, use the `DefaultFutureBackend` / `HttpClientFutureBackend` * finally, if you are using a functional effect wrapper, use one of the "functional" backends, for [ZIO](zio.md), [Monix](monix.md), [Scalaz](scalaz.md), [cats-effect](catseffect.md) or [fs2](fs2.md). @@ -39,6 +40,7 @@ Class Effect type Supported ``HttpURLConnectionBackend`` None (``Identity``) ``java.io.InputStream`` (blocking) no no ``TryHttpURLConnectionBackend`` ``scala.util.Try`` ``java.io.InputStream`` (blocking) no no ``AkkaHttpBackend`` ``scala.concurrent.Future`` ``akka.stream.scaladsl.Source[ByteString, Any]`` yes (regular & streaming) yes +``PekkoHttpBackend`` ``scala.concurrent.Future`` ``org.apache.pekko.stream.scaladsl.Source[ByteString, Any]`` yes (regular & streaming) yes ``ArmeriaFutureBackend`` ``scala.concurrent.Future`` n/a no yes ``ArmeriaScalazBackend`` ``scalaz.concurrent.Task`` n/a no yes ``ArmeriaZioBackend`` ``zio.Task`` ``zio.stream.Stream[Throwable, Byte]`` no yes diff --git a/generated-docs/out/backends/synchronous.md b/generated-docs/out/backends/synchronous.md index f2603b697f..58af33f01e 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.client4" %% "core" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13" ``` 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.client4" %% "core" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13" ``` 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.client4" %% "okhttp-backend" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "okhttp-backend" % "4.0.0-M13" ``` Create the backend using: diff --git a/generated-docs/out/backends/wrappers/custom.md b/generated-docs/out/backends/wrappers/custom.md index 72360400fd..9d0614ecd1 100644 --- a/generated-docs/out/backends/wrappers/custom.md +++ b/generated-docs/out/backends/wrappers/custom.md @@ -260,7 +260,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.client4" %% "core" % "4.0.0-M12" % Test classifier "tests" +"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13" % Test classifier "tests" ``` Implement your backend and extend the `HttpTest` class: @@ -290,9 +290,9 @@ import sttp.client4.impl.cats.implicits._ from the cats integration module. The module should be available on the classpath after adding following dependency: ```scala -"com.softwaremill.sttp.client4" %% "cats" % "4.0.0-M12" // for cats-effect 3.x +"com.softwaremill.sttp.client4" %% "cats" % "4.0.0-M13" // for cats-effect 3.x // or -"com.softwaremill.sttp.client4" %% "catsce2" % "4.0.0-M12" // for cats-effect 2.x +"com.softwaremill.sttp.client4" %% "catsce2" % "4.0.0-M13" // 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 eca398162c..6e184d0bc8 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.client4" %% "slf4j-backend" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "slf4j-backend" % "4.0.0-M13" ``` 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). @@ -53,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.client4" %% "scribe-backend" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "scribe-backend" % "4.0.0-M13" ``` \ 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 59ae243bda..775da18412 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.client4" %% "opentelemetry-metrics-backend" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "opentelemetry-metrics-backend" % "4.0.0-M13" ``` Then an instance can be obtained as follows: @@ -55,7 +55,7 @@ OpenTelemetryMetricsBackend( To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client4" %% "opentelemetry-tracing-zio-backend" % "4.0.0-M12" // for ZIO 2.x +"com.softwaremill.sttp.client4" %% "opentelemetry-tracing-zio-backend" % "4.0.0-M13" // 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 32c1f04afd..4fab3243a1 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.client4" %% "prometheus-backend" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "prometheus-backend" % "4.0.0-M13" ``` and some imports: diff --git a/generated-docs/out/backends/zio.md b/generated-docs/out/backends/zio.md index 952e91c5c2..aad5792e29 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.client4" %% "zio" % "4.0.0-M12" // for ZIO 2.x -"com.softwaremill.sttp.client4" %% "zio1" % "4.0.0-M12" // for ZIO 1.x +"com.softwaremill.sttp.client4" %% "zio" % "4.0.0-M13" // for ZIO 2.x +"com.softwaremill.sttp.client4" %% "zio1" % "4.0.0-M13" // 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.client4" %% "armeria-backend-zio" % "4.0.0-M12" // for ZIO 2.x -"com.softwaremill.sttp.client4" %% "armeria-backend-zio1" % "4.0.0-M12" // for ZIO 1.x +"com.softwaremill.sttp.client4" %% "armeria-backend-zio" % "4.0.0-M13" // for ZIO 2.x +"com.softwaremill.sttp.client4" %% "armeria-backend-zio1" % "4.0.0-M13" // for ZIO 1.x ``` add imports: diff --git a/generated-docs/out/examples.md b/generated-docs/out/examples.md index 7426263396..e9f0dd3ce8 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.client4" %% "core" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13") ``` Example code: @@ -22,7 +22,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "core" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13") ``` Example code: @@ -38,8 +38,8 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client4" %% "akka-http-backend" % "4.0.0-M12", - "com.softwaremill.sttp.client4" %% "json4s" % "4.0.0-M12", + "com.softwaremill.sttp.client4" %% "akka-http-backend" % "4.0.0-M13", + "com.softwaremill.sttp.client4" %% "json4s" % "4.0.0-M13", "org.json4s" %% "json4s-native" % "3.6.0" ) ``` @@ -57,8 +57,8 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client4" %% "zio" % "4.0.0-M12", - "com.softwaremill.sttp.client4" %% "circe" % "4.0.0-M12", + "com.softwaremill.sttp.client4" %% "zio" % "4.0.0-M13", + "com.softwaremill.sttp.client4" %% "circe" % "4.0.0-M13", "io.circe" %% "circe-generic" % "0.14.6" ) ``` @@ -76,8 +76,8 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client4" %% "monix" % "4.0.0-M12", - "com.softwaremill.sttp.client4" %% "circe" % "4.0.0-M12", + "com.softwaremill.sttp.client4" %% "monix" % "4.0.0-M13", + "com.softwaremill.sttp.client4" %% "circe" % "4.0.0-M13", "io.circe" %% "circe-generic" % "0.14.6" ) ``` @@ -95,8 +95,8 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client4" %% "slf4j-backend" % "4.0.0-M12", - "com.softwaremill.sttp.client4" %% "circe" % "4.0.0-M12", + "com.softwaremill.sttp.client4" %% "slf4j-backend" % "4.0.0-M13", + "com.softwaremill.sttp.client4" %% "circe" % "4.0.0-M13", "io.circe" %% "circe-generic" % "0.14.6" ) ``` @@ -114,8 +114,8 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client4" %% "monix" % "4.0.0-M12", - "com.softwaremill.sttp.client4" %% "circe" % "4.0.0-M12", + "com.softwaremill.sttp.client4" %% "monix" % "4.0.0-M13", + "com.softwaremill.sttp.client4" %% "circe" % "4.0.0-M13", "io.circe" %% "circe-generic" % "0.14.6" ) ``` @@ -132,7 +132,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "core" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13") ``` Example code: @@ -146,7 +146,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "zio" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "zio" % "4.0.0-M13") ``` Example code: @@ -161,7 +161,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "fs2" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "fs2" % "4.0.0-M13") ``` Example code: @@ -176,7 +176,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "monix" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "monix" % "4.0.0-M13") ``` Example code: @@ -191,7 +191,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "akka-http-backend" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "akka-http-backend" % "4.0.0-M13") ``` Example code: @@ -206,7 +206,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "pekko-http-backend" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "pekko-http-backend" % "4.0.0-M13") ``` Example code: @@ -221,7 +221,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "monix" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "monix" % "4.0.0-M13") ``` Example code: @@ -236,7 +236,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "fs2" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "fs2" % "4.0.0-M13") ``` Example code: @@ -251,7 +251,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "zio" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "zio" % "4.0.0-M13") ``` Example code: @@ -266,7 +266,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "zio" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "zio" % "4.0.0-M13") ``` Example code: @@ -281,7 +281,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "core" % "4.0.0-M12") +libraryDependencies ++= List("com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13") ``` Example code: diff --git a/generated-docs/out/json.md b/generated-docs/out/json.md index 3baaabf45c..1bd443edbb 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.client4" %% "circe" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "circe" % "4.0.0-M13" ``` 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.client4" %% "json4s" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "json4s" % "4.0.0-M13" "org.json4s" %% "json4s-native" % "3.6.0" ``` @@ -100,7 +100,7 @@ val response: Response[Either[ResponseException[String, Exception], ResponsePayl To encode and decode JSON using [spray-json](https://github.com/spray/spray-json), add the following dependency to your project: ``` -"com.softwaremill.sttp.client4" %% "spray-json" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "spray-json" % "4.0.0-M13" ``` 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: Response[Either[ResponseException[String, Exception], ResponsePayl To encode and decode JSON using [play-json](https://www.playframework.com), add the following dependency to your project: ```scala -"com.softwaremill.sttp.client4" %% "play-json" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "play-json" % "4.0.0-M13" ``` If you use older version of play (2.9.x), add the following dependency to your project: ```scala -"com.softwaremill.sttp.client4" %% "play29-json" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "play29-json" % "4.0.0-M13" ``` To use, add an import: `import sttp.client4.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.client4" %% "zio-json" % "4.0.0-M12" // for ZIO 2.x -"com.softwaremill.sttp.client4" %% "zio1-json" % "4.0.0-M12" // for ZIO 1.x +"com.softwaremill.sttp.client4" %% "zio-json" % "4.0.0-M13" // for ZIO 2.x +"com.softwaremill.sttp.client4" %% "zio1-json" % "4.0.0-M13" // for ZIO 1.x ``` or for ScalaJS (cross build) projects: ```scala -"com.softwaremill.sttp.client4" %%% "zio-json" % "4.0.0-M12" // for ZIO 2.x -"com.softwaremill.sttp.client4" %%% "zio1-json" % "4.0.0-M12" // for ZIO 1.x +"com.softwaremill.sttp.client4" %%% "zio-json" % "4.0.0-M13" // for ZIO 2.x +"com.softwaremill.sttp.client4" %%% "zio1-json" % "4.0.0-M13" // for ZIO 1.x ``` To use, add an import: `import sttp.client4.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.client4" %% "jsoniter" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "jsoniter" % "4.0.0-M13" ``` or for ScalaJS (cross build) projects: ```scala -"com.softwaremill.sttp.client4" %%% "jsoniter" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %%% "jsoniter" % "4.0.0-M13" ``` To use, add an import: `import sttp.client4.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.client4" %% "upickle" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "upickle" % "4.0.0-M13" ``` or for ScalaJS (cross build) projects: ```scala -"com.softwaremill.sttp.client4" %%% "upickle" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %%% "upickle" % "4.0.0-M13" ``` To use, add an import: `import sttp.client4.upicklejson.default._` 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 636e1970b3..828064aecc 100644 --- a/generated-docs/out/openapi.md +++ b/generated-docs/out/openapi.md @@ -43,8 +43,8 @@ lazy val petstoreApi: Project = project openApiGeneratorName := "scala-sttp", openApiOutputDir := baseDirectory.value.name, libraryDependencies ++= Seq( - "com.softwaremill.sttp.client4" %% "core" % "4.0.0-M12", - "com.softwaremill.sttp.client4" %% "json4s" % "4.0.0-M12", + "com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13", + "com.softwaremill.sttp.client4" %% "json4s" % "4.0.0-M13", "org.json4s" %% "json4s-jackson" % "3.6.8" ) ) @@ -94,8 +94,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.client4" %% "core" % "4.0.0-M12", - "com.softwaremill.sttp.client4" %% "json4s" % "4.0.0-M12", + "com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13", + "com.softwaremill.sttp.client4" %% "json4s" % "4.0.0-M13", "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 e0f719da19..cc3c2ee937 100644 --- a/generated-docs/out/quickstart.md +++ b/generated-docs/out/quickstart.md @@ -15,7 +15,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.client4" %% "core" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M13" ``` ## Using scala-cli @@ -23,7 +23,7 @@ The basic dependency which provides the API, together with a synchronous and `Fu Add the following directive to the top of your scala file to add the core sttp dependency: ``` -//> using lib "com.softwaremill.sttp.client4::core:4.0.0-M12" +//> using dep "com.softwaremill.sttp.client4::core:4.0.0-M13" ``` ## Using Ammonite @@ -31,7 +31,7 @@ Add the following directive to the top of your scala file to add the core sttp d 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.client4::core:4.0.0-M12` +import $ivy.`com.softwaremill.sttp.client4::core:4.0.0-M13` ``` ## Imports @@ -72,7 +72,7 @@ As an example, to integrate with the [uPickle](https://github.com/com-lihaoyi/up dependency: ```scala -"com.softwaremill.sttp.client4" %% "upickle" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "upickle" % "4.0.0-M13" ``` Your code might then look as follows: @@ -109,7 +109,7 @@ Logging can be added using the [logging backend wrapper](backends/wrappers/loggi use slf4j, you'll need the following dependency: ``` -"com.softwaremill.sttp.client4" %% "slf4j-backend" % "4.0.0-M12" +"com.softwaremill.sttp.client4" %% "slf4j-backend" % "4.0.0-M13" ``` Then, you'll need to configure your client: diff --git a/generated-docs/out/requests/headers.md b/generated-docs/out/requests/headers.md index 1e178dcbbc..46fa656963 100644 --- a/generated-docs/out/requests/headers.md +++ b/generated-docs/out/requests/headers.md @@ -10,7 +10,10 @@ basicRequest.header("User-Agent", "myapp") As with any other request definition modifier, this method will yield a new request, which has the given header set. The headers can be set at any point when defining the request, arbitrarily interleaved with other modifiers. -While most headers should be set only once on a request, HTTP allows setting a header multiple times. That's why the `header` method has an additional optional boolean parameter, `replaceExisting`, which defaults to `true`. This way, if the same header is specified twice, only the last value will be included in the request. If previous values should be preserved, set this parameter to `false`. +While most headers should be set only once on a request, HTTP allows setting a header multiple times, or with multiple values. That's why the `header` method has an additional parameter, `onDuplicate`, which by default is set to `DuplicateHeaderBehavior.Replace`. This way, if the same header is specified twice, only the last value will be included in the request. Alternatively: + +* if previous values should be preserved, set this parameter to `DuplicateHeaderBehavior.Add` +* if the values of the headers should be combined using `,`, or in case of cookies with `;`, use `DuplicateHeaderBehavior.Combine` There are also variants of this method accepting a number of headers: @@ -18,9 +21,9 @@ There are also variants of this method accepting a number of headers: import sttp.client4._ import sttp.model._ -basicRequest.header(Header("k1", "v1"), replaceExisting = false) +basicRequest.header(Header("k1", "v1"), onDuplicate = DuplicateHeaderBehavior.Add) basicRequest.header("k2", "v2") -basicRequest.header("k3", "v3", replaceExisting = true) +basicRequest.header("k3", "v3", DuplicateHeaderBehavior.Combine) basicRequest.headers(Map("k4" -> "v4", "k5" -> "v5")) basicRequest.headers(Header("k9", "v9"), Header("k10", "v10"), Header("k11", "v11")) ``` diff --git a/generated-docs/out/testing.md b/generated-docs/out/testing.md index 0350f62a6a..99fc243fb4 100644 --- a/generated-docs/out/testing.md +++ b/generated-docs/out/testing.md @@ -53,12 +53,12 @@ It is also possible to match requests by partial function, returning a response. val testingBackend = SyncBackendStub .whenRequestMatchesPartial({ case r if r.uri.path.endsWith(List("partial10")) => - Response("Not found", StatusCode.NotFound) + ResponseStub("Not found", StatusCode.NotFound) case r if r.uri.path.endsWith(List("partialAda")) => // additional verification of the request is possible assert(r.body == StringBody("z", "utf-8")) - Response.ok("Ada") + ResponseStub.ok("Ada") }) val response1 = basicRequest.get(uri"http://example.org/partial10").send(testingBackend) @@ -81,7 +81,7 @@ val testingBackend = BackendStub.asynchronousFuture .whenAnyRequest .thenRespondF(Future { Thread.sleep(5000) - Response.ok(Right("OK")) + ResponseStub.ok(Right("OK")) }) val responseFuture = basicRequest.get(uri"http://example.org").send(testingBackend) @@ -94,7 +94,7 @@ The returned response may also depend on the request: val testingBackend = SyncBackendStub .whenAnyRequest .thenRespondF(req => - Response.ok(Right(s"OK, got request sent to ${req.uri.host}")) + ResponseStub.ok(Right(s"OK, got request sent to ${req.uri.host}")) ) val response = basicRequest.get(uri"http://example.org").send(testingBackend) @@ -120,8 +120,8 @@ Or multiple `Response` instances: val testingBackend: SyncBackendStub = SyncBackendStub .whenAnyRequest .thenRespondCyclicResponses( - Response.ok[String]("first"), - Response("error", StatusCode.InternalServerError, "Something went wrong") + ResponseStub.ok[String]("first"), + ResponseStub("error", StatusCode.InternalServerError, "Something went wrong") ) basicRequest.get(uri"http://example.org").send(testingBackend) // code will be 200