From 430328fdd3bc66a55d7169b7e2f27bbabbd1bcb3 Mon Sep 17 00:00:00 2001 From: adamw Date: Thu, 8 Apr 2021 13:35:19 +0200 Subject: [PATCH] Release 3.3.0-RC1 --- README.md | 8 +- .../adr/0001-extract-stream-from-http4s.md | 2 +- generated-docs/out/backends/akka.md | 4 +- generated-docs/out/backends/catseffect.md | 56 +++---- generated-docs/out/backends/finagle.md | 2 +- generated-docs/out/backends/fs2.md | 143 ++++++++++-------- generated-docs/out/backends/future.md | 8 +- generated-docs/out/backends/http4s.md | 28 ++-- .../out/backends/javascript/fetch.md | 8 +- generated-docs/out/backends/monix.md | 12 +- generated-docs/out/backends/native/curl.md | 2 +- generated-docs/out/backends/scalaz.md | 4 +- generated-docs/out/backends/summary.md | 8 +- generated-docs/out/backends/synchronous.md | 4 +- .../out/backends/wrappers/custom.md | 2 +- .../out/backends/wrappers/logging.md | 4 +- .../out/backends/wrappers/opentracing.md | 4 +- .../out/backends/wrappers/prometheus.md | 2 +- .../out/backends/wrappers/zio-opentracing.md | 2 +- generated-docs/out/backends/zio.md | 6 +- generated-docs/out/examples.md | 50 +++--- generated-docs/out/json.md | 12 +- generated-docs/out/openapi.md | 8 +- generated-docs/out/quickstart.md | 6 +- generated-docs/out/testing.md | 2 - 25 files changed, 200 insertions(+), 187 deletions(-) diff --git a/README.md b/README.md index a424c67d10..31fc93f5f3 100755 --- a/README.md +++ b/README.md @@ -45,14 +45,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.2.3) +scaladoc is available at [https://www.javadoc.io](https://www.javadoc.io/doc/com.softwaremill.sttp.client3/core_2.12/3.3.0-RC1) ## 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.2.3` +import $ivy.`com.softwaremill.sttp.client3::core:3.3.0-RC1` import sttp.client3.quick._ quickRequest.get(uri"http://httpbin.org/ip").send(backend) ``` @@ -64,7 +64,7 @@ This brings in the sttp API and a synchronous backend instance. Add the following dependency: ```scala -"com.softwaremill.sttp.client3" %% "core" % "3.2.3" +"com.softwaremill.sttp.client3" %% "core" % "3.3.0-RC1" ``` Then, import: @@ -98,7 +98,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.2.3"`, before running `mdoc` in `docs`. +That is, in sbt run: `set version := "3.3.0-RC1"`, before running `mdoc` in `docs`. ### Testing the Scala.JS backend diff --git a/generated-docs/out/adr/0001-extract-stream-from-http4s.md b/generated-docs/out/adr/0001-extract-stream-from-http4s.md index 1f803bff4e..21be2d0c5b 100644 --- a/generated-docs/out/adr/0001-extract-stream-from-http4s.md +++ b/generated-docs/out/adr/0001-extract-stream-from-http4s.md @@ -20,7 +20,7 @@ This way of consuming streams is less safe, but that's a design decision of sttp to adjust the way http4s works and "extract" the stream from http4s, releasing the connection only when the stream is fully read (or completes with an error). -To do that, in `Http4sBackend`, we create two `MVar`s: one to signal that the request body has been fully +To do that, in `Http4sBackend`, we create two `Deferred`s: one to signal that the request body has been fully consumed (`responseBodyCompleteVar`), and another, `responseVar`, to extract the response. When the request is read, first the stream body is adjusted, so that the completion var is filled in the stream's diff --git a/generated-docs/out/backends/akka.md b/generated-docs/out/backends/akka.md index 9fe39d6449..9d230833de 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.2.3" +"com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.3.0-RC1" ``` 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. @@ -11,7 +11,7 @@ A fully **asynchronous** backend. Uses the `Future` effect to return responses. Note that you'll also need an explicit dependency on akka-streams, as akka-http doesn't depend on any specific akka-streams version. So you'll also need to add, for example: ``` -"com.typesafe.akka" %% "akka-stream" % "2.6.13" +"com.typesafe.akka" %% "akka-stream" % "2.6.14" ``` Next you'll need to add create the backend instance: diff --git a/generated-docs/out/backends/catseffect.md b/generated-docs/out/backends/catseffect.md index b49f66b7fc..b483ad309f 100644 --- a/generated-docs/out/backends/catseffect.md +++ b/generated-docs/out/backends/catseffect.md @@ -7,23 +7,14 @@ The [Cats Effect](https://github.com/typelevel/cats-effect) backend is **asynchr To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "async-http-client-backend-cats" % "3.2.3" -``` - -You'll need the following imports and implicits to create the backend: - -```scala -import sttp.client3._ -import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend -import cats.effect._ - -// an implicit `cats.effect.ContextShift` in required to create the backend; here, for `cats.effect.IO`: -implicit val cs: ContextShift[IO] = IO.contextShift(scala.concurrent.ExecutionContext.global) +"com.softwaremill.sttp.client3" %% "async-http-client-backend-cats" % "3.3.0-RC1" // for cats-effect 3.x +// or +"com.softwaremill.sttp.client3" %% "async-http-client-backend-cats-ce2" % "3.3.0-RC1" // for cats-effect 2.x ``` This backend depends on [async-http-client](https://github.com/AsyncHttpClient/async-http-client), uses [Netty](http://netty.io) behind the scenes. -Alternatively, the [http4s](http4s.md) backend can also be created for a type implementing the cats-effect's `Effect` typeclass, and supports streaming as in [fs2](fs2.md). +Alternatively, the [http4s](http4s.md) backend can also be created for a type implementing the cats-effect's `Async` typeclass, and supports streaming as in [fs2](fs2.md). Next you'll need to define a backend instance. This can be done in two basic ways: @@ -33,15 +24,21 @@ Next you'll need to define a backend instance. This can be done in two basic way A non-comprehensive summary of how the backend can be created is as follows: ```scala +import cats.effect.IO +import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend + // the type class instance needs to be provided explicitly (e.g. `cats.effect.IO`). -// the effect type must implement the Concurrent typeclass +// the effect type must implement the Async typeclass AsyncHttpClientCatsBackend[IO]().flatMap { backend => ??? } ``` or, if you'd like to use a custom configuration: ```scala +import cats.effect.IO import org.asynchttpclient.AsyncHttpClientConfig +import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend + val config: AsyncHttpClientConfig = ??? AsyncHttpClientCatsBackend.usingConfig[IO](config).flatMap { backend => ??? } ``` @@ -49,23 +46,31 @@ AsyncHttpClientCatsBackend.usingConfig[IO](config).flatMap { backend => ??? } or, if you'd like to use adjust the configuration sttp creates: ```scala +import cats.effect.IO import org.asynchttpclient.DefaultAsyncHttpClientConfig +import sttp.client3.SttpBackendOptions +import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend val sttpOptions: SttpBackendOptions = SttpBackendOptions.Default val adjustFunction: DefaultAsyncHttpClientConfig.Builder => DefaultAsyncHttpClientConfig.Builder = ??? AsyncHttpClientCatsBackend.usingConfigBuilder[IO](adjustFunction, sttpOptions).flatMap { backend => ??? } ``` -or, if you'd like the backend to be wrapped in cats-effect Resource: +or, if you'd like the backend to be wrapped in cats-effect `Resource`: ```scala +import cats.effect.IO +import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend + AsyncHttpClientCatsBackend.resource[IO]().use { backend => ??? } ``` -or, if you'd like to instantiate the AsyncHttpClient yourself: +or, if you'd like to instantiate the `AsyncHttpClient` yourself: ```scala +import cats.effect.IO import org.asynchttpclient.AsyncHttpClient +import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend val asyncHttpClient: AsyncHttpClient = ??? val backend = AsyncHttpClientCatsBackend.usingClient[IO](asyncHttpClient) @@ -75,29 +80,28 @@ val backend = AsyncHttpClientCatsBackend.usingClient[IO](asyncHttpClient) To use, add the following dependency to your project: -``` -"com.softwaremill.sttp.client3" %% "armeria-backend-cats" % "3.2.3" -``` - -add imports: - ```scala -import sttp.client3.armeria.cats.ArmeriaCatsBackend -import cats.effect.{ContextShift, IO} +"com.softwaremill.sttp.client3" %% "armeria-backend-cats" % "3.3.0-RC1" // for cats-effect 3.x +// or +"com.softwaremill.sttp.client3" %% "armeria-backend-cats-ce2" % "3.3.0-RC1" // for cats-effect 2.x ``` create client: ```scala -implicit val cs: ContextShift[IO] = IO.contextShift(scala.concurrent.ExecutionContext.global) +import cats.effect.IO +import sttp.client3.armeria.cats.ArmeriaCatsBackend + val backend = ArmeriaCatsBackend[IO]() ``` or, if you'd like to instantiate the [WebClient](https://armeria.dev/docs/client-http) yourself: ```scala -import com.linecorp.armeria.client.circuitbreaker._ +import cats.effect.IO import com.linecorp.armeria.client.WebClient +import com.linecorp.armeria.client.circuitbreaker._ +import sttp.client3.armeria.cats.ArmeriaCatsBackend // Fluently build Armeria WebClient with built-in decorators val client = WebClient.builder("https://my-service.com") diff --git a/generated-docs/out/backends/finagle.md b/generated-docs/out/backends/finagle.md index 88f4b8a12b..07e3b72e37 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.2.3" +"com.softwaremill.sttp.client3" %% "finagle-backend" % "3.3.0-RC1" ``` 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 525d215cb0..d11fd6c867 100644 --- a/generated-docs/out/backends/fs2.md +++ b/generated-docs/out/backends/fs2.md @@ -7,111 +7,125 @@ The [fs2](https://github.com/functional-streams-for-scala/fs2) backend is **asyn To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "async-http-client-backend-fs2" % "3.2.3" +"com.softwaremill.sttp.client3" %% "async-http-client-backend-fs2" % "3.3.0-RC1" // for cats-effect 3.x & fs2 3.x +// or +"com.softwaremill.sttp.client3" %% "async-http-client-backend-fs2-ce2" % "3.3.0-RC1" // for cats-effect 2.x & fs2 2.x ``` + +This backend depends on [async-http-client](https://github.com/AsyncHttpClient/async-http-client) and uses [Netty](http://netty.io) behind the scenes. + +Next you'll need to define a backend instance as an implicit value. This can be done in two basic ways: -And some imports: +* by creating a `Resource`, which will instantiate the backend (along with a `Dispatcher`) and close it after it has been used +* by creating an effect, which describes how a backend is created, or instantiating the backend directly. In this case, you'll need to close the backend manually, as well as provide a `Dispatcher` instance + +Below you can find a non-comprehensive summary of how the backend can be created. The easiest form is to use a cats-effect `Resource`: ```scala +import cats.effect.IO import sttp.client3.asynchttpclient.fs2.AsyncHttpClientFs2Backend -import cats.effect._ -import sttp.client3._ -// an implicit `cats.effect.ContextShift` is required to create a concurrent instance for `cats.effect.IO`, -// as well as a `cats.effect.Blocker` instance. Note that you'll probably want to use a different thread -// pool for blocking. -implicit val cs: ContextShift[IO] = IO.contextShift(scala.concurrent.ExecutionContext.global) -val blocker: Blocker = Blocker.liftExecutionContext(scala.concurrent.ExecutionContext.global) +AsyncHttpClientFs2Backend.resource[IO]().use { backend => ??? } ``` - -This backend depends on [async-http-client](https://github.com/AsyncHttpClient/async-http-client) and uses [Netty](http://netty.io) behind the scenes. -Next you'll need to define a backend instance as an implicit value. This can be done in two basic ways: +or, by providing a custom dispatcher: -* by creating an effect, which describes how a backend is created, or instantiating the backend directly. In this case, you'll need to close the backend manually -* by creating a `Resource`, which will instantiate the backend and close it after it has been used +```scala +import cats.effect.IO +import cats.effect.std.Dispatcher +import sttp.client3.asynchttpclient.fs2.AsyncHttpClientFs2Backend -A non-comprehensive summary of how the backend can be created is as follows: +val dispatcher: Dispatcher[IO] = ??? -```scala -AsyncHttpClientFs2Backend[IO](blocker).flatMap { backend => ??? } +AsyncHttpClientFs2Backend[IO](dispatcher).flatMap { backend => ??? } ``` or, if you'd like to use a custom configuration: ```scala +import cats.effect.IO +import cats.effect.std.Dispatcher import org.asynchttpclient.AsyncHttpClientConfig +import sttp.client3.asynchttpclient.fs2.AsyncHttpClientFs2Backend + +val dispatcher: Dispatcher[IO] = ??? val config: AsyncHttpClientConfig = ??? -AsyncHttpClientFs2Backend.usingConfig[IO](blocker, config).flatMap { backend => ??? } +AsyncHttpClientFs2Backend.usingConfig[IO](config, dispatcher).flatMap { backend => ??? } ``` or, if you'd like to use adjust the configuration sttp creates: ```scala +import cats.effect.IO +import cats.effect.std.Dispatcher import org.asynchttpclient.DefaultAsyncHttpClientConfig +import sttp.client3.SttpBackendOptions +import sttp.client3.asynchttpclient.fs2.AsyncHttpClientFs2Backend val sttpOptions: SttpBackendOptions = SttpBackendOptions.Default val adjustFunction: DefaultAsyncHttpClientConfig.Builder => DefaultAsyncHttpClientConfig.Builder = ??? -AsyncHttpClientFs2Backend.usingConfigBuilder[IO](blocker, adjustFunction, sttpOptions).flatMap { backend => ??? } -``` +val dispatcher: Dispatcher[IO] = ??? -or, if you'd like the backend to be wrapped in cats-effect Resource: - -```scala -AsyncHttpClientFs2Backend.resource[IO](blocker).use { backend => ??? } +AsyncHttpClientFs2Backend.usingConfigBuilder[IO](dispatcher, adjustFunction, sttpOptions).flatMap { backend => ??? } ``` or, if you'd like to instantiate the AsyncHttpClient yourself: ```scala +import cats.effect.IO +import cats.effect.std.Dispatcher import org.asynchttpclient.AsyncHttpClient +import sttp.client3.asynchttpclient.fs2.AsyncHttpClientFs2Backend +val dispatcher: Dispatcher[IO] = ??? val asyncHttpClient: AsyncHttpClient = ??? -val backend = AsyncHttpClientFs2Backend.usingClient[IO](asyncHttpClient, blocker) +val backend = AsyncHttpClientFs2Backend.usingClient[IO](asyncHttpClient, dispatcher) ``` ## Using HttpClient (Java 11+) To use, add the following dependency to your project: -``` -"com.softwaremill.sttp.client3" %% "httpclient-backend-fs2" % "3.2.3" +```scala +"com.softwaremill.sttp.client3" %% "httpclient-backend-fs2" % "3.3.0-RC1" // for cats-effect 3.x & fs2 3.x +// or +"com.softwaremill.sttp.client3" %% "httpclient-backend-fs2-ce2" % "3.3.0-RC1" // for cats-effect 2.x & fs2 2.x ``` -And some imports: +Create the backend using a cats-effect `Resource`: ```scala +import cats.effect.IO import sttp.client3.httpclient.fs2.HttpClientFs2Backend -import cats.effect._ -import sttp.client3._ -// an implicit `cats.effect.ContextShift` is required to create a concurrent instance for `cats.effect.IO`, -// as well as a `cats.effect.Blocker` instance. Note that you'll probably want to use a different thread -// pool for blocking. -implicit val cs: ContextShift[IO] = IO.contextShift(scala.concurrent.ExecutionContext.global) -val blocker = Blocker.liftExecutionContext(scala.concurrent.ExecutionContext.global) +HttpClientFs2Backend.resource[IO]().use { backend => ??? } ``` -Create the backend using: +or, if by providing a custom `Dispatcher`: ```scala +import cats.effect.IO +import cats.effect.std.Dispatcher import sttp.client3.httpclient.fs2.HttpClientFs2Backend -HttpClientFs2Backend[IO](blocker).flatMap { backend => ??? } -``` -or, if you'd like the backend to be wrapped in cats-effect Resource: +val dispatcher: Dispatcher[IO] = ??? -```scala -HttpClientFs2Backend.resource[IO](blocker).use { backend => ??? } +HttpClientFs2Backend[IO](dispatcher).flatMap { backend => ??? } ``` -or, if you'd like to instantiate the HttpClient yourself: +or, if you'd like to instantiate the `HttpClient` yourself: ```scala +import cats.effect.IO +import cats.effect.std.Dispatcher import java.net.http.HttpClient +import sttp.client3.httpclient.fs2.HttpClientFs2Backend + val httpClient: HttpClient = ??? -val backend = HttpClientFs2Backend.usingClient[IO](httpClient, blocker) +val dispatcher: Dispatcher[IO] = ??? + +val backend = HttpClientFs2Backend.usingClient[IO](httpClient, dispatcher) ``` This backend is based on the built-in `java.net.http.HttpClient` available from Java 11 onwards. @@ -125,29 +139,31 @@ jdk.httpclient.allowRestrictedHeaders=host To use, add the following dependency to your project: -``` -"com.softwaremill.sttp.client3" %% "armeria-backend-fs2" % "3.2.3" -``` - -add imports: - ```scala -import sttp.client3.armeria.fs2.ArmeriaFs2Backend -import cats.effect.{ContextShift, IO} +"com.softwaremill.sttp.client3" %% "armeria-backend-fs2" % "3.3.0-RC1" // for cats-effect 3.x & fs2 3.x +// or +"com.softwaremill.sttp.client3" %% "armeria-backend-fs2" % "3.3.0-RC1" // for cats-effect 2.x & fs2 2.x ``` create client: ```scala -implicit val cs: ContextShift[IO] = IO.contextShift(scala.concurrent.ExecutionContext.global) -val backend = ArmeriaFs2Backend[IO]() +import cats.effect.IO +import sttp.client3.armeria.fs2.ArmeriaFs2Backend + +ArmeriaFs2Backend.resource[IO]().use { backend => ??? } ``` or, if you'd like to instantiate the [WebClient](https://armeria.dev/docs/client-http) yourself: ```scala -import com.linecorp.armeria.client.circuitbreaker._ +import cats.effect.IO +import cats.effect.std.Dispatcher import com.linecorp.armeria.client.WebClient +import com.linecorp.armeria.client.circuitbreaker._ +import sttp.client3.armeria.fs2.ArmeriaFs2Backend + +val dispatcher: Dispatcher[IO] = ??? // Fluently build Armeria WebClient with built-in decorators val client = WebClient.builder("https://my-service.com") @@ -156,14 +172,14 @@ val client = WebClient.builder("https://my-service.com") CircuitBreakerRule.onServerErrorStatus())) .build() -val backend = ArmeriaFs2Backend.usingClient[IO](client) +val backend = ArmeriaFs2Backend.usingClient[IO](client, dispatcher) ``` ```eval_rst .. note:: A WebClient could fail to follow redirects if the WebClient is created with a base URI and a redirect location is a different URI. ``` -This backend is build on top of [Armeria](https://armeria.dev/docs/client-http). +This backend is built on top of [Armeria](https://armeria.dev/docs/client-http). ## Streaming @@ -172,12 +188,14 @@ The fs2 backend supports streaming for any instance of the `cats.effect.Effect` Requests can be sent with a streaming body like this: ```scala +import cats.effect.IO +import fs2.Stream import sttp.capabilities.fs2.Fs2Streams import sttp.client3._ +import sttp.client3.armeria.fs2.ArmeriaFs2Backend import sttp.client3.asynchttpclient.fs2.AsyncHttpClientFs2Backend -import fs2.Stream -val effect = AsyncHttpClientFs2Backend[IO](blocker).flatMap { backend => +val effect = AsyncHttpClientFs2Backend.resource[IO]().use { backend => val stream: Stream[IO, Byte] = ??? basicRequest @@ -190,12 +208,14 @@ val effect = AsyncHttpClientFs2Backend[IO](blocker).flatMap { backend => Responses can also be streamed: ```scala +import cats.effect.IO +import fs2.Stream import sttp.capabilities.fs2.Fs2Streams +import sttp.client3._ import sttp.client3.asynchttpclient.fs2.AsyncHttpClientFs2Backend -import fs2.Stream import scala.concurrent.duration.Duration -val effect = AsyncHttpClientFs2Backend[IO](blocker).flatMap { backend => +val effect = AsyncHttpClientFs2Backend.resource[IO]().use { backend => val response: IO[Response[Either[String, Stream[IO, Byte]]]] = basicRequest .post(uri"...") @@ -218,11 +238,10 @@ Received data streams can be parsed to a stream of server-sent events (SSE): ```scala import cats.effect._ import fs2.Stream - +import sttp.client3._ import sttp.capabilities.fs2.Fs2Streams import sttp.client3.impl.fs2.Fs2ServerSentEvents import sttp.model.sse.ServerSentEvent -import sttp.client3._ def processEvents(source: Stream[IO, ServerSentEvent]): IO[Unit] = ??? diff --git a/generated-docs/out/backends/future.md b/generated-docs/out/backends/future.md index 5bce056b32..362a9014c7 100644 --- a/generated-docs/out/backends/future.md +++ b/generated-docs/out/backends/future.md @@ -21,7 +21,7 @@ Class Supported stream type To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "async-http-client-backend-future" % "3.2.3" +"com.softwaremill.sttp.client3" %% "async-http-client-backend-future" % "3.3.0-RC1" ``` And some imports: @@ -72,7 +72,7 @@ val backend = AsyncHttpClientFutureBackend.usingClient(asyncHttpClient) To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "okhttp-backend" % "3.2.3" +"com.softwaremill.sttp.client3" %% "okhttp-backend" % "3.3.0-RC1" ``` and some imports: @@ -104,7 +104,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" %% "httpclient-backend" % "3.2.3" +"com.softwaremill.sttp.client3" %% "httpclient-backend" % "3.3.0-RC1" ``` and some imports: @@ -141,7 +141,7 @@ jdk.httpclient.allowRestrictedHeaders=host To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "armeria-backend-future" % "3.2.3" +"com.softwaremill.sttp.client3" %% "armeria-backend-future" % "3.3.0-RC1" ``` add imports: diff --git a/generated-docs/out/backends/http4s.md b/generated-docs/out/backends/http4s.md index 5ca9a454b1..95bdc90477 100644 --- a/generated-docs/out/backends/http4s.md +++ b/generated-docs/out/backends/http4s.md @@ -2,31 +2,21 @@ This backend is based on [http4s](https://http4s.org) (client) and is **asynchronous**. To use, add the following dependency to your project: -``` -"com.softwaremill.sttp.client3" %% "http4s-backend" % "3.2.3" +```scala +"com.softwaremill.sttp.client3" %% "http4s-backend" % "3.3.0-RC1" // for cats-effect 3.x & http4s 1.0.0-Mx +// or +"com.softwaremill.sttp.client3" %% "http4s-backend-ce2" % "3.3.0-RC1" // for cats-effect 2.x & http4s 0.21.x ``` -Add some imports as well: +The backend can be created in a couple of ways, e.g.: ```scala import cats.effect._ +import sttp.capabilities.fs2.Fs2Streams +import sttp.client3._ import sttp.client3.http4s._ -import scala.concurrent._ - -// an implicit `cats.effect.ContextShift` is required to create an instance of `cats.effect.Concurrent` -// for `cats.effect.IO`, as well as a `cats.effect.Blocker` instance. -// Note that you'll probably want to use a different thread pool for blocking. -implicit val cs: ContextShift[IO] = IO.contextShift(ExecutionContext.global) -val blocker: cats.effect.Blocker = Blocker.liftExecutionContext(ExecutionContext.global) -``` -The backend can be created for any type implementing the `cats.effect.ConcurrentEffect` typeclass, such as `cats.effect.IO`. Moreover, an implicit `ContextShift` will have to be in scope as well. - -If a blocker instance is not available, a new one can be created, and the resource definition can be chained, e.g. as follows: - -```scala -implicit val cs: ContextShift[IO] = IO.contextShift(scala.concurrent.ExecutionContext.global) // or another instance -Blocker[IO].flatMap(Http4sBackend.usingDefaultBlazeClientBuilder[IO](_)).use { implicit backend => ... } +Http4sBackend.usingDefaultBlazeClientBuilder[IO](): Resource[IO, SttpBackend[IO, Fs2Streams[IO]]] ``` Sending a request is a non-blocking, lazily-evaluated operation and results in a wrapped response. There's a transitive dependency on `http4s`. @@ -36,7 +26,7 @@ There are also [other cats-effect-based backends](catseffect.md), which don't de Please note that: * the backend contains an **optional** dependency on `http4s-blaze-client`, to provide the `Http4sBackend.usingBlazeClientBuilder` and `Http4sBackend.usingDefaultBlazeClientBuilder` methods. This makes the client usable with other http4s client implementations, without the need to depend on blaze. -* the backend does not support `SttpBackendOptions`,that is specifying proxy settings (proxies are not implemented in http4s, see [this issue](https://github.com/http4s/http4s/issues/251)), as well as configuring the connect timeout +* the backend does not support `SttpBackendOptions`, that is specifying proxy settings (proxies are not implemented in http4s, see [this issue](https://github.com/http4s/http4s/issues/251)), as well as configuring the connect timeout * the backend does not support the `RequestT.options.readTimeout` option Instead, all custom timeout configuration should be done by creating a `org.http4s.client.Client[F]`, using e.g. `org.http4s.client.blaze.BlazeClientBuilder[F]` and passing it to the appropriate method of the `Http4sBackend` object. diff --git a/generated-docs/out/backends/javascript/fetch.md b/generated-docs/out/backends/javascript/fetch.md index a8c045def2..d8a27e096e 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.2.3" +"com.softwaremill.sttp.client3" %%% "core" % "3.3.0-RC1" ``` 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.2.3" +"com.softwaremill.sttp.client3" %%% "monix" % "3.3.0-RC1" ``` And create the backend instance: @@ -41,7 +41,7 @@ Any effect implementing the cats-effect `Concurrent` typeclass can be used. To u your project: ``` -"com.softwaremill.sttp.client3" %%% "cats" % "3.2.3" +"com.softwaremill.sttp.client3" %%% "cats" % "3.3.0-RC1" ``` And create the backend instance: @@ -80,7 +80,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.2.3" +"com.softwaremill.sttp.client3" %%% "monix" % "3.3.0-RC1" ``` An example of streaming a response: diff --git a/generated-docs/out/backends/monix.md b/generated-docs/out/backends/monix.md index 6fb4344f4d..75130abfcf 100644 --- a/generated-docs/out/backends/monix.md +++ b/generated-docs/out/backends/monix.md @@ -7,7 +7,7 @@ There are several backend implementations which are `monix.eval.Task`-based. The To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "async-http-client-backend-monix" % "3.2.3" +"com.softwaremill.sttp.client3" %% "async-http-client-backend-monix" % "3.3.0-RC1" ``` This backend depends on [async-http-client](https://github.com/AsyncHttpClient/async-http-client), uses [Netty](http://netty.io) behind the scenes. @@ -35,13 +35,13 @@ AsyncHttpClientMonixBackend.usingConfig(config).flatMap { backend => ??? } // or, if you'd like to use adjust the configuration sttp creates: import org.asynchttpclient.DefaultAsyncHttpClientConfig -val sttpOptions: SttpBackendOptions = SttpBackendOptions.Default +val sttpOptions: SttpBackendOptions = SttpBackendOptions.Default val adjustFunction: DefaultAsyncHttpClientConfig.Builder => DefaultAsyncHttpClientConfig.Builder = ??? AsyncHttpClientMonixBackend.usingConfigBuilder(adjustFunction, sttpOptions).flatMap { backend => ??? } // or, if you'd like to instantiate the AsyncHttpClient yourself: import org.asynchttpclient.AsyncHttpClient -val asyncHttpClient: AsyncHttpClient = ??? +val asyncHttpClient: AsyncHttpClient = ??? val backend = AsyncHttpClientMonixBackend.usingClient(asyncHttpClient) ``` @@ -50,7 +50,7 @@ val backend = AsyncHttpClientMonixBackend.usingClient(asyncHttpClient) To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "okhttp-backend-monix" % "3.2.3" +"com.softwaremill.sttp.client3" %% "okhttp-backend-monix" % "3.3.0-RC1" ``` 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" %% "httpclient-backend-monix" % "3.2.3" +"com.softwaremill.sttp.client3" %% "httpclient-backend-monix" % "3.3.0-RC1" ``` Create the backend using: @@ -107,7 +107,7 @@ jdk.httpclient.allowRestrictedHeaders=host To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "armeria-backend-monix" % "3.2.3" +"com.softwaremill.sttp.client3" %% "armeria-backend-monix" % "3.3.0-RC1" ``` add imports: diff --git a/generated-docs/out/backends/native/curl.md b/generated-docs/out/backends/native/curl.md index aaf2a68110..750fe0ea84 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.2.3" +"com.softwaremill.sttp.client3" %%% "core" % "3.3.0-RC1" ``` and initialize one of the backends: diff --git a/generated-docs/out/backends/scalaz.md b/generated-docs/out/backends/scalaz.md index 0eaa4ff123..960aa9f5d9 100644 --- a/generated-docs/out/backends/scalaz.md +++ b/generated-docs/out/backends/scalaz.md @@ -7,7 +7,7 @@ The [Scalaz](https://github.com/scalaz/scalaz) backend is **asynchronous**. Send To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "async-http-client-backend-scalaz" % "3.2.3" +"com.softwaremill.sttp.client3" %% "async-http-client-backend-scalaz" % "3.3.0-RC1" ``` This backend depends on [async-http-client](https://github.com/AsyncHttpClient/async-http-client) and uses [Netty](http://netty.io) behind the scenes. @@ -45,7 +45,7 @@ val backend = AsyncHttpClientScalazBackend.usingClient(asyncHttpClient) To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "armeria-backend-scalaz" % "3.2.3" +"com.softwaremill.sttp.client3" %% "armeria-backend-scalaz" % "3.3.0-RC1" ``` add imports: diff --git a/generated-docs/out/backends/summary.md b/generated-docs/out/backends/summary.md index 4e6c5bfb53..86f6e5fb7e 100644 --- a/generated-docs/out/backends/summary.md +++ b/generated-docs/out/backends/summary.md @@ -1,8 +1,8 @@ # Supported backends -sttp supports a number of synchronous and asynchronous backends. It's the backends that take care of managing connections, sending requests and receiving responses: sttp defines only the API to describe the requests to be send and handle the response data. Backends do all the heavy-lifting. +sttp supports a number of synchronous and asynchronous backends. It's the backends that take care of managing connections, sending requests and receiving responses: sttp defines only the API to describe the requests to be sent and handle the response data. Backends do all the heavy-lifting. Typically, a single backend instance is created for the lifetime of the application. -Choosing the right backend depends on a number of factors: whether you are using sttp to explore some data, or is it a production system; are you using a synchronous, blocking architecture or an asynchronous one; do you work mostly with Scala's `Future`, or maybe you use some form of a `Task` abstraction; finally, if you want to stream requests/responses, or not. +Choosing the right backend depends on a number of factors: whether you are using sttp to explore some data, or is it a production system; are you using a synchronous, blocking architecture, or an asynchronous one; do you work mostly with Scala's `Future`, or maybe you use some form of a `Task` abstraction; finally, if you want to stream requests/responses, or not. Which one to choose? @@ -50,7 +50,9 @@ Class Effect type Supported ==================================== ================================ ================================================= ========================== =================== ``` -The backends work with Scala 2.11, 2.12 and 2.13 (with some exceptions for 2.11). Moreover, `HttpURLConnectionBackend`, `AsyncHttpClientFutureBackend`, `AsyncHttpClientZioBackend`, `HttpClientSyncBackend`, `HttpClientFutureBackend` and `HttpClientZioBackend` are additionally built with Scala 3. +The backends work with Scala 2.11, 2.12, 2.13 and 3 (with some exceptions for 2.11 and 3). + +Backends supporting cats-effect are available in versions for cats-effect 2.x (dependency artifacts have the `-ce2` suffix) and 3.x. All backends that support asynchronous/non-blocking streams, also support server-sent events. diff --git a/generated-docs/out/backends/synchronous.md b/generated-docs/out/backends/synchronous.md index 6fc0224c2b..11512f4190 100644 --- a/generated-docs/out/backends/synchronous.md +++ b/generated-docs/out/backends/synchronous.md @@ -25,7 +25,7 @@ sun.net.http.allowRestrictedHeaders=true To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "okhttp-backend" % "3.2.3" +"com.softwaremill.sttp.client3" %% "okhttp-backend" % "3.3.0-RC1" ``` Create the backend using: @@ -53,7 +53,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" %% "httpclient-backend" % "3.2.3" +"com.softwaremill.sttp.client3" %% "httpclient-backend" % "3.3.0-RC1" ``` Create the backend using: diff --git a/generated-docs/out/backends/wrappers/custom.md b/generated-docs/out/backends/wrappers/custom.md index fb3af33384..ee9acfb164 100644 --- a/generated-docs/out/backends/wrappers/custom.md +++ b/generated-docs/out/backends/wrappers/custom.md @@ -266,7 +266,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.2.3" % Test classifier "tests" +"com.softwaremill.sttp.client3" %% "core" % "3.3.0-RC1" % Test classifier "tests" ``` Implement your backend and extend the `HttpTest` class: diff --git a/generated-docs/out/backends/wrappers/logging.md b/generated-docs/out/backends/wrappers/logging.md index 33b89936eb..6aae285ae9 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.2.3" +"com.softwaremill.sttp.client3" %% "slf4j-backend" % "3.3.0-RC1" ``` 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). @@ -50,5 +50,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.2.3" +"com.softwaremill.sttp.client3" %% "scribe-backend" % "3.3.0-RC1" ``` \ No newline at end of file diff --git a/generated-docs/out/backends/wrappers/opentracing.md b/generated-docs/out/backends/wrappers/opentracing.md index d88db7e5e6..19322c0a61 100644 --- a/generated-docs/out/backends/wrappers/opentracing.md +++ b/generated-docs/out/backends/wrappers/opentracing.md @@ -3,7 +3,7 @@ To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "opentracing-backend" % "3.2.3" +"com.softwaremill.sttp.client3" %% "opentracing-backend" % "3.3.0-RC1" ``` This backend depends on [opentracing](https://github.com/opentracing/opentracing-java), a standardized set of api for distributed tracing. @@ -47,7 +47,7 @@ Using with [jaeger](https://www.jaegertracing.io/) tracing Add following dependency: ``` -libraryDependencies += "io.jaegertracing" % "jaeger-client" % "1.5.0" +libraryDependencies += "io.jaegertracing" % "jaeger-client" % "1.6.0" ``` Create an instance of tracer: diff --git a/generated-docs/out/backends/wrappers/prometheus.md b/generated-docs/out/backends/wrappers/prometheus.md index e3d7a0a807..87752b9077 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.2.3" +"com.softwaremill.sttp.client3" %% "prometheus-backend" % "3.3.0-RC1" ``` and some imports: diff --git a/generated-docs/out/backends/wrappers/zio-opentracing.md b/generated-docs/out/backends/wrappers/zio-opentracing.md index 59dc5dfa12..2d7896ba24 100644 --- a/generated-docs/out/backends/wrappers/zio-opentracing.md +++ b/generated-docs/out/backends/wrappers/zio-opentracing.md @@ -3,7 +3,7 @@ To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "zio-telemetry-opentracing-backend" % "3.2.3" +"com.softwaremill.sttp.client3" %% "zio-telemetry-opentracing-backend" % "3.3.0-RC1" ``` This backend depends on [zio-opentracing](https://github.com/zio/zio-telemetry). diff --git a/generated-docs/out/backends/zio.md b/generated-docs/out/backends/zio.md index 05752df8c1..c16a5f6c08 100644 --- a/generated-docs/out/backends/zio.md +++ b/generated-docs/out/backends/zio.md @@ -7,7 +7,7 @@ The [ZIO](https://github.com/zio/zio) backends are **asynchronous**. Sending a r To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "httpclient-backend-zio" % "3.2.3" +"com.softwaremill.sttp.client3" %% "httpclient-backend-zio" % "3.3.0-RC1" ``` Create the backend using: @@ -38,7 +38,7 @@ jdk.httpclient.allowRestrictedHeaders=host To use, add the following dependency to your project: ```scala -"com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % "3.2.3" +"com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % "3.3.0-RC1" ``` This backend depends on [async-http-client](https://github.com/AsyncHttpClient/async-http-client), uses [Netty](http://netty.io) behind the scenes. This backend works with all Scala versions. A Scala 3 build is available as well. @@ -84,7 +84,7 @@ val backend = AsyncHttpClientZioBackend.usingClient(runtime, asyncHttpClient) To use, add the following dependency to your project: ``` -"com.softwaremill.sttp.client3" %% "armeria-backend-zio" % "3.2.3" +"com.softwaremill.sttp.client3" %% "armeria-backend-zio" % "3.3.0-RC1" ``` add imports: diff --git a/generated-docs/out/examples.md b/generated-docs/out/examples.md index 80048bde88..f206b7fa1b 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.2.3") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.3.0-RC1") ``` Example code: @@ -23,8 +23,8 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.2.3", - "com.softwaremill.sttp.client3" %% "json4s" % "3.2.3", + "com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.3.0-RC1", + "com.softwaremill.sttp.client3" %% "json4s" % "3.3.0-RC1", "org.json4s" %% "json4s-native" % "3.6.0" ) ``` @@ -42,8 +42,8 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % "3.2.3", - "com.softwaremill.sttp.client3" %% "circe" % "3.2.3", + "com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % "3.3.0-RC1", + "com.softwaremill.sttp.client3" %% "circe" % "3.3.0-RC1", "io.circe" %% "circe-generic" % "0.13.0" ) ``` @@ -61,8 +61,8 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client3" %% "async-http-client-backend-monix" % "3.2.3", - "com.softwaremill.sttp.client3" %% "circe" % "3.2.3", + "com.softwaremill.sttp.client3" %% "async-http-client-backend-monix" % "3.3.0-RC1", + "com.softwaremill.sttp.client3" %% "circe" % "3.3.0-RC1", "io.circe" %% "circe-generic" % "0.13.0" ) ``` @@ -70,7 +70,7 @@ libraryDependencies ++= List( Example code: ```eval_rst -.. literalinclude:: ../../examples/src/main/scala/sttp/client3/examples/GetAndParseJsonGetRightMonixCirce.scala +.. literalinclude:: ../../examples/src/main/scala/sttp/client3/examples-ce2/GetAndParseJsonGetRightMonixCirce.scala :language: scala ``` @@ -80,8 +80,8 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client3" %% "slf4j-backend" % "3.2.3", - "com.softwaremill.sttp.client3" %% "circe" % "3.2.3", + "com.softwaremill.sttp.client3" %% "slf4j-backend" % "3.3.0-RC1", + "com.softwaremill.sttp.client3" %% "circe" % "3.3.0-RC1", "io.circe" %% "circe-generic" % "0.13.0" ) ``` @@ -99,8 +99,8 @@ Required dependencies: ```scala libraryDependencies ++= List( - "com.softwaremill.sttp.client3" %% "async-http-client-backend-monix" % "3.2.3", - "com.softwaremill.sttp.client3" %% "circe" % "3.2.3", + "com.softwaremill.sttp.client3" %% "async-http-client-backend-monix" % "3.3.0-RC1", + "com.softwaremill.sttp.client3" %% "circe" % "3.3.0-RC1", "io.circe" %% "circe-generic" % "0.13.0" ) ``` @@ -108,7 +108,7 @@ libraryDependencies ++= List( Example code: ```eval_rst -.. literalinclude:: ../../examples/src/main/scala/sttp/client3/examples/PostSerializeJsonMonixAsyncHttpClientCirce.scala +.. literalinclude:: ../../examples/src/main/scala/sttp/client3/examples-ce2/PostSerializeJsonMonixAsyncHttpClientCirce.scala :language: scala ``` @@ -117,7 +117,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.2.3") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.3.0-RC1") ``` Example code: @@ -132,7 +132,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % "3.2.3") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % "3.3.0-RC1") ``` Example code: @@ -147,7 +147,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-fs2 % "3.2.3") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-fs2 % "3.3.0-RC1") ``` Example code: @@ -162,13 +162,13 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-monix % "3.2.3") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-monix % "3.3.0-RC1") ``` Example code: ```eval_rst -.. literalinclude:: ../../examples/src/main/scala/sttp/client3/examples/WebSocketTesting.scala +.. literalinclude:: ../../examples/src/main/scala/sttp/client3/examples-ce2/WebSocketTesting.scala :language: scala ``` @@ -177,7 +177,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.2.3") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.3.0-RC1") ``` Example code: @@ -192,13 +192,13 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-monix" % "3.2.3") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-monix" % "3.3.0-RC1") ``` Example code: ```eval_rst -.. literalinclude:: ../../examples/src/main/scala/sttp/client3/examples/WebSocketMonix.scala +.. literalinclude:: ../../examples/src/main/scala/sttp/client3/examples-ce2/WebSocketMonix.scala :language: scala ``` @@ -207,7 +207,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-fs2" % "3.2.3") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-fs2" % "3.3.0-RC1") ``` Example code: @@ -222,7 +222,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % "3.2.3") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % "3.3.0-RC1") ``` Example code: @@ -237,7 +237,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % "3.2.3") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % "3.3.0-RC1") ``` Example code: @@ -252,7 +252,7 @@ Example code: Required dependencies: ```scala -libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.2.3") +libraryDependencies ++= List("com.softwaremill.sttp.client3" %% "core" % "3.3.0-RC1") ``` Example code: diff --git a/generated-docs/out/json.md b/generated-docs/out/json.md index d4d102cf94..1b68d5dce2 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.2.3" +"com.softwaremill.sttp.client3" %% "circe" % "3.3.0-RC1" ``` 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.2.3" +"com.softwaremill.sttp.client3" %% "json4s" % "3.3.0-RC1" "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.2.3" +"com.softwaremill.sttp.client3" %% "spray-json" % "3.3.0-RC1" ``` 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,7 +132,7 @@ 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.2.3" +"com.softwaremill.sttp.client3" %% "play-json" % "3.3.0-RC1" ``` To use, add an import: `import sttp.client3.playJson._`. @@ -142,11 +142,11 @@ To use, add an import: `import sttp.client3.playJson._`. To encode and decode JSON using the high-performance [zio-json](https://zio.github.io/zio-json/) library, one add the following dependency to your project. ```scala -"com.softwaremill.sttp.client3" %% "zio-json" % "3.2.3" +"com.softwaremill.sttp.client3" %% "zio-json" % "3.3.0-RC1" ``` or for ScalaJS (cross build) projects: ```scala -"com.softwaremill.sttp.client3" %%% "zio-json" % "3.2.3" +"com.softwaremill.sttp.client3" %%% "zio-json" % "3.3.0-RC1" ``` To use, add an import: `import sttp.client3.ziojson._` (or extend `SttpZioJsonApi`), define an implicit `JsonCodec`, or `JsonDecoder`/`JsonEncoder` for your datatype. diff --git a/generated-docs/out/openapi.md b/generated-docs/out/openapi.md index 041e0af2f8..e87f0a2171 100644 --- a/generated-docs/out/openapi.md +++ b/generated-docs/out/openapi.md @@ -36,8 +36,8 @@ lazy val petstoreApi: Project = project openApiGeneratorName := "scala-sttp", openApiOutputDir := baseDirectory.value.name, libraryDependencies ++= Seq( - "com.softwaremill.sttp.client3" %% "core" % "3.2.3", - "com.softwaremill.sttp.client3" %% "json4s" % "3.2.3", + "com.softwaremill.sttp.client3" %% "core" % "3.3.0-RC1", + "com.softwaremill.sttp.client3" %% "json4s" % "3.3.0-RC1", "org.json4s" %% "json4s-jackson" % "3.6.8" ) ) @@ -87,8 +87,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.2.3", - "com.softwaremill.sttp.client3" %% "json4s" % "3.2.3", + "com.softwaremill.sttp.client3" %% "core" % "3.3.0-RC1", + "com.softwaremill.sttp.client3" %% "json4s" % "3.3.0-RC1", "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 e92ac5186b..734fdf6121 100644 --- a/generated-docs/out/quickstart.md +++ b/generated-docs/out/quickstart.md @@ -9,7 +9,7 @@ To integrate with other parts of your application, you'll often need to use an a The basic dependency which provides the API and the default synchronous backend is: ```scala -"com.softwaremill.sttp.client3" %% "core" % "3.2.3" +"com.softwaremill.sttp.client3" %% "core" % "3.3.0-RC1" ``` `sttp client` is available for Scala 2.11, 2.12 and 2.13, and requires Java 8, as well as for Scala 3. @@ -21,7 +21,7 @@ The basic dependency which provides the API and the default synchronous backend 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.2.3` +import $ivy.`com.softwaremill.sttp.client3::core:3.3.0-RC1` import sttp.client3.quick._ quickRequest.get(uri"http://httpbin.org/ip").send(backend) ``` @@ -31,7 +31,7 @@ Importing the `quick` object has the same effect as importing `sttp.client3._`, If the default `HttpURLConnectionBackend` for some reason is insufficient, you can also use one based on OkHttp or HttpClient: ```scala -import $ivy.`com.softwaremill.sttp.client3::okhttp-backend:3.2.3` +import $ivy.`com.softwaremill.sttp.client3::okhttp-backend:3.3.0-RC1` import sttp.client3.okhttp.quick._ quickRequest.get(uri"http://httpbin.org/ip").send(backend) ``` diff --git a/generated-docs/out/testing.md b/generated-docs/out/testing.md index bf1030825f..2d8849d3fa 100644 --- a/generated-docs/out/testing.md +++ b/generated-docs/out/testing.md @@ -203,8 +203,6 @@ import cats.effect._ import sttp.client3.impl.cats.implicits._ import sttp.monad.MonadAsyncError -implicit val cs: ContextShift[IO] = IO.contextShift(scala.concurrent.ExecutionContext.global) - val sourceFile = new File("path/to/file.ext") val destinationFile = new File("path/to/file.ext") SttpBackendStub(implicitly[MonadAsyncError[IO]])