Skip to content

Commit

Permalink
Release 4.0.0-M23
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed Jan 14, 2025
1 parent 0a2aaa9 commit 563aa56
Show file tree
Hide file tree
Showing 51 changed files with 564 additions and 561 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The library is available for Scala 2.12, 2.13 and 3. Supported platforms are the
Here's a quick example of sttp client in action, runnable using [scala-cli](https://scala-cli.virtuslab.org):

```scala
//> using dep com.softwaremill.sttp.client4::core:4.0.0-M22
//> using dep com.softwaremill.sttp.client4::core:4.0.0-M23

import sttp.client4.quick.*

Expand All @@ -37,7 +37,7 @@ Additionally, sttp client seamlessly integrates with popular libraries for JSON
Some more features: URI interpolation, a self-managed backend, and type-safe HTTP error/success representation, are demonstrated by the below example:

```scala
//> using dep com.softwaremill.sttp.client4::core:4.0.0-M22
//> using dep com.softwaremill.sttp.client4::core:4.0.0-M23

import sttp.client4.*

Expand Down Expand Up @@ -72,15 +72,15 @@ 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-M22)
scaladoc is available at [https://www.javadoc.io](https://www.javadoc.io/doc/com.softwaremill.sttp.client4/core_2.12/4.0.0-M23)

## Quickstart with scala-cli

Add the following directive to the top of your scala file to add the core sttp dependency:
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-M22"
//> using dep "com.softwaremill.sttp.client4::core:4.0.0-M23"
import sttp.client4.quick.*
quickRequest.get(uri"http://httpbin.org/ip").send()
```
Expand All @@ -92,7 +92,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-M22`
import $ivy.`com.softwaremill.sttp.client4::core:4.0.0-M23`
import sttp.client4.quick.*
quickRequest.get(uri"http://httpbin.org/ip").send()
```
Expand All @@ -102,7 +102,7 @@ quickRequest.get(uri"http://httpbin.org/ip").send()
Add the following dependency:

```scala
"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M22"
"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M23"
```

Then, import:
Expand Down Expand Up @@ -160,7 +160,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 ThisBuild/version := "4.0.0-M22"`, before running `mdoc` in `docs`.
That is, in sbt run: `set ThisBuild/version := "4.0.0-M23"`, before running `mdoc` in `docs`.

### Testing the Scala.JS backend

Expand Down
6 changes: 3 additions & 3 deletions generated-docs/out/backends/akka.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M22"
"com.softwaremill.sttp.client4" %% "akka-http-backend" % "4.0.0-M23"
```

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.
Expand Down Expand Up @@ -69,11 +69,11 @@ val response: Future[Response[Either[String, Source[ByteString, Any]]]] =
.send(backend)
```

The akka-http backend support both regular and streaming [websockets](../websockets.md).
The akka-http backend support both regular and streaming [websockets](../other/websockets.md).

## Testing

Apart from testing using [the stub](../testing.md), you can create a backend using any `HttpRequest => Future[HttpResponse]` function, or an akka-http `Route`.
Apart from testing using [the stub](../testing/stub.md), you can create a backend using any `HttpRequest => Future[HttpResponse]` function, or an akka-http `Route`.

That way, you can "mock" a server that the backend will talk to, without starting any actual server or making any HTTP calls.

Expand Down
17 changes: 9 additions & 8 deletions generated-docs/out/backends/catseffect.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# cats-effect backend

The [Cats Effect](https://github.com/typelevel/cats-effect) backend is **asynchronous**.
It can be created for any type implementing the `cats.effect.Concurrent` typeclass, such as `cats.effect.IO`.
It can be created for any type implementing the `cats.effect.kernel.Async` typeclass, such as `cats.effect.IO`.
Sending a request is a non-blocking, lazily-evaluated operation and results in a wrapped response.
There's a transitive dependency on `cats-effect`.

Expand All @@ -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-M22"
"com.softwaremill.sttp.client4" %% "cats" % "4.0.0-M23"
```

Obtain a cats-effect `Resource` which creates the backend, and closes the thread pool after the resource is no longer used:
Expand Down Expand Up @@ -82,9 +82,10 @@ 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-M22" // for cats-effect 3.x
// or
"com.softwaremill.sttp.client4" %% "armeria-backend-cats-ce2" % "4.0.0-M22" // for cats-effect 2.x
// for cats-effect 3.x
"com.softwaremill.sttp.client4" %% "armeria-backend-cats" % "4.0.0-M23"
// or for cats-effect 2.x
"com.softwaremill.sttp.client4" %% "armeria-backend-cats-ce2" % "4.0.0-M23"
```

create client:
Expand Down Expand Up @@ -126,8 +127,8 @@ val client = WebClient.builder("https://my-service.com")
val backend = ArmeriaCatsBackend.usingClient[IO](client)
```

```{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.
```{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).
Expand All @@ -140,4 +141,4 @@ This backend doesn't support non-blocking [streaming](../requests/streaming.md).

## Websockets

The backend doesn't support [websockets](../websockets.md).
The backend doesn't support [websockets](../other/websockets.md).
4 changes: 2 additions & 2 deletions generated-docs/out/backends/finagle.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To use, add the following dependency to your project:

```
"com.softwaremill.sttp.client4" %% "finagle-backend" % "4.0.0-M22"
"com.softwaremill.sttp.client4" %% "finagle-backend" % "4.0.0-M23"
```

Next you'll need to add an implicit value:
Expand All @@ -17,4 +17,4 @@ This backend depends on [finagle](https://twitter.github.io/finagle/), and offer

Please note that:

* the backend does not support non-blocking [streaming](../requests/streaming.md) or [websockets](../websockets.md).
* the backend does not support non-blocking [streaming](../requests/streaming.md) or [websockets](../other/websockets.md).
19 changes: 10 additions & 9 deletions generated-docs/out/backends/fs2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# fs2 backend

The [fs2](https://github.com/functional-streams-for-scala/fs2) backends are **asynchronous**. They can be created for any type implementing the `cats.effect.Async` typeclass, such as `cats.effect.IO`. Sending a request is a non-blocking, lazily-evaluated operation and results in a wrapped response. There's a transitive dependency on `cats-effect`.
The [fs2](https://github.com/functional-streams-for-scala/fs2) backends are **asynchronous**. They can be created for any type implementing the `cats.effect.kernel.Async` typeclass, such as `cats.effect.IO`. Sending a request is a non-blocking, lazily-evaluated operation and results in a wrapped response. There's a transitive dependency on `cats-effect`.

## Using HttpClient

Expand All @@ -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-M22" // for cats-effect 3.x & fs2 3.x
"com.softwaremill.sttp.client4" %% "fs2" % "4.0.0-M23" // for cats-effect 3.x & fs2 3.x
// or
"com.softwaremill.sttp.client4" %% "fs2ce2" % "4.0.0-M22" // for cats-effect 2.x & fs2 2.x
"com.softwaremill.sttp.client4" %% "fs2ce2" % "4.0.0-M23" // 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:
Expand Down Expand Up @@ -77,9 +77,10 @@ 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-M22" // for cats-effect 3.x & fs2 3.x
// or
"com.softwaremill.sttp.client4" %% "armeria-backend-fs2" % "4.0.0-M22" // for cats-effect 2.x & fs2 2.x
// for cats-effect 3.x & fs2 3.x
"com.softwaremill.sttp.client4" %% "armeria-backend-fs2" % "4.0.0-M23"
// or for cats-effect 2.x & fs2 2.x
"com.softwaremill.sttp.client4" %% "armeria-backend-fs2" % "4.0.0-M23"
```

create client:
Expand Down Expand Up @@ -117,8 +118,8 @@ val client = WebClient.builder("https://my-service.com")
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.
```{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 built on top of [Armeria](https://armeria.dev/docs/client-http).
Expand Down Expand Up @@ -174,7 +175,7 @@ val effect = HttpClientFs2Backend.resource[IO]().use { backend =>

## Websockets

The fs2 backends support both regular and streaming [websockets](../websockets.md).
The fs2 backends support both regular and streaming [websockets](../other/websockets.md).

## Server-sent events

Expand Down
12 changes: 6 additions & 6 deletions generated-docs/out/backends/future.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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-M22"
"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M23"
```

You'll need the following imports:
Expand Down Expand Up @@ -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-M22"
"com.softwaremill.sttp.client4" %% "okhttp-backend" % "4.0.0-M23"
```

and some imports:
Expand Down Expand Up @@ -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-M22"
"com.softwaremill.sttp.client4" %% "armeria-backend" % "4.0.0-M23"
```

add imports:
Expand Down Expand Up @@ -125,8 +125,8 @@ val client = WebClient.builder("https://my-service.com")
val backend = ArmeriaFutureBackend.usingClient(client)
```

```{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.
```{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) and doesn't support host header override.
Expand All @@ -141,4 +141,4 @@ Other backends don't support non-blocking [streaming](../requests/streaming.md).

## Websockets

Some of the backends (see above) support regular and streaming [websockets](../websockets.md).
Some of the backends (see above) support regular and streaming [websockets](../other/websockets.md).
9 changes: 5 additions & 4 deletions generated-docs/out/backends/http4s.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
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-M22" // for cats-effect 3.x & http4s 1.0.0-Mx
// or
"com.softwaremill.sttp.client4" %% "http4s-ce2-backend" % "4.0.0-M22" // for cats-effect 2.x & http4s 0.21.x
// for cats-effect 3.x & http4s 1.0.0-Mx
"com.softwaremill.sttp.client4" %% "http4s-backend" % "4.0.0-M23"
// or for cats-effect 2.x & http4s 0.21.x
"com.softwaremill.sttp.client4" %% "http4s-ce2-backend" % "4.0.0-M23"
```

The backend can be created in a couple of ways, e.g.:
Expand Down Expand Up @@ -37,4 +38,4 @@ Instead, all custom timeout configuration should be done by creating a `org.http

The backend supports streaming using fs2. For usage details, see the documentation on [streaming using fs2](fs2.md).

The backend doesn't support [websockets](../websockets.md).
The backend doesn't support [websockets](../other/websockets.md).
20 changes: 10 additions & 10 deletions generated-docs/out/backends/javascript/fetch.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# JavaScript (Fetch) backend
# Scala.js (Fetch) backend

A JavaScript backend with web socket support. Implemented using the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).

Expand All @@ -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-M22"
"com.softwaremill.sttp.client4" %%% "core" % "4.0.0-M23"
```

And create the backend instance:
Expand All @@ -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-M22"
"com.softwaremill.sttp.client4" %%% "monix" % "4.0.0-M23"
```

And create the backend instance:
Expand All @@ -40,7 +40,7 @@ val backend = FetchMonixBackend()
To use, add the following dependency to your project:

```
"com.softwaremill.sttp.client4" %%% "zio" % "4.0.0-M22"
"com.softwaremill.sttp.client4" %%% "zio" % "4.0.0-M23"
```

And create the backend instance:
Expand All @@ -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-M22"
"com.softwaremill.sttp.client4" %%% "cats" % "4.0.0-M23"
```

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-M22"
"com.softwaremill.sttp.client4" %%% "catsce2" % "4.0.0-M23"
```

And create the backend instance:
Expand Down Expand Up @@ -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-M22"
"com.softwaremill.sttp.client4" %%% "monix" % "4.0.0-M23"
```

An example of streaming a response:
Expand All @@ -151,13 +151,13 @@ val response: Task[Response[Observable[ByteBuffer]]] =
.send(backend)
```

```{eval-rst}
.. note:: Currently no browsers support passing a stream as the request body. As such, using the ``Fetch`` backend with a streaming request will result in it being converted into an in-memory array before being sent. Response bodies are returned as a "proper" stream.
```{note}
Currently no browsers support passing a stream as the request body. As such, using the `Fetch` backend with a streaming request will result in it being converted into an in-memory array before being sent. Response bodies are returned as a "proper" stream.
```

## Websockets

The backend supports both regular and streaming [websockets](../../websockets.md).
The backend supports both regular and streaming [websockets](../../other/websockets.md).

## Server-sent events

Expand Down
12 changes: 6 additions & 6 deletions generated-docs/out/backends/monix.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M22"
"com.softwaremill.sttp.client4" %% "monix" % "4.0.0-M23"
```

and create the backend using:
Expand Down Expand Up @@ -49,7 +49,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-M22"
"com.softwaremill.sttp.client4" %% "okhttp-backend-monix" % "4.0.0-M23"
```

Create the backend using:
Expand All @@ -75,7 +75,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-M22"
"com.softwaremill.sttp.client4" %% "armeria-backend-monix" % "4.0.0-M23"
```

add imports:
Expand Down Expand Up @@ -110,8 +110,8 @@ val client = WebClient.builder("https://my-service.com")
val backend = ArmeriaMonixBackend.usingClient(client)
```

```{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.
```{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).
Expand Down Expand Up @@ -163,7 +163,7 @@ HttpClientMonixBackend().flatMap { backend =>

## Websockets

The Monix backend supports both regular and streaming [websockets](../websockets.md).
The Monix backend supports both regular and streaming [websockets](../other/websockets.md).

## Server-sent events

Expand Down
Loading

0 comments on commit 563aa56

Please sign in to comment.