Skip to content

Commit

Permalink
Release 4.0.0-M15
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed May 27, 2024
1 parent 4b5a428 commit 3432ec5
Show file tree
Hide file tree
Showing 27 changed files with 145 additions and 112 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,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-M14)
scaladoc is available at [https://www.javadoc.io](https://www.javadoc.io/doc/com.softwaremill.sttp.client4/core_2.12/4.0.0-M15)

## 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-M14"
//> using dep "com.softwaremill.sttp.client4::core:4.0.0-M15"
import sttp.client4.quick._
quickRequest.get(uri"http://httpbin.org/ip").send()
```
Expand All @@ -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-M14`
import $ivy.`com.softwaremill.sttp.client4::core:4.0.0-M15`
import sttp.client4.quick._
quickRequest.get(uri"http://httpbin.org/ip").send()
```
Expand All @@ -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-M14"
"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M15"
```

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

### Testing the Scala.JS backend

Expand Down
2 changes: 1 addition & 1 deletion 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-M14"
"com.softwaremill.sttp.client4" %% "akka-http-backend" % "4.0.0-M15"
```

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
6 changes: 3 additions & 3 deletions generated-docs/out/backends/catseffect.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M14"
"com.softwaremill.sttp.client4" %% "cats" % "4.0.0-M15"
```

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,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-M14" // for cats-effect 3.x
"com.softwaremill.sttp.client4" %% "armeria-backend-cats" % "4.0.0-M15" // for cats-effect 3.x
// or
"com.softwaremill.sttp.client4" %% "armeria-backend-cats-ce2" % "4.0.0-M14" // for cats-effect 2.x
"com.softwaremill.sttp.client4" %% "armeria-backend-cats-ce2" % "4.0.0-M15" // for cats-effect 2.x
```

create client:
Expand Down
3 changes: 1 addition & 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-M14"
"com.softwaremill.sttp.client4" %% "finagle-backend" % "4.0.0-M15"
```

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

Please note that:

* 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 non-blocking [streaming](../requests/streaming.md) or [websockets](../websockets.md).
8 changes: 4 additions & 4 deletions generated-docs/out/backends/fs2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M14" // for cats-effect 3.x & fs2 3.x
"com.softwaremill.sttp.client4" %% "fs2" % "4.0.0-M15" // for cats-effect 3.x & fs2 3.x
// or
"com.softwaremill.sttp.client4" %% "fs2ce2" % "4.0.0-M14" // for cats-effect 2.x & fs2 2.x
"com.softwaremill.sttp.client4" %% "fs2ce2" % "4.0.0-M15" // 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 @@ -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-M14" // for cats-effect 3.x & fs2 3.x
"com.softwaremill.sttp.client4" %% "armeria-backend-fs2" % "4.0.0-M15" // for cats-effect 3.x & fs2 3.x
// or
"com.softwaremill.sttp.client4" %% "armeria-backend-fs2" % "4.0.0-M14" // for cats-effect 2.x & fs2 2.x
"com.softwaremill.sttp.client4" %% "armeria-backend-fs2" % "4.0.0-M15" // for cats-effect 2.x & fs2 2.x
```

create client:
Expand Down
6 changes: 3 additions & 3 deletions generated-docs/out/backends/future.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M14"
"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M15"
```

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-M14"
"com.softwaremill.sttp.client4" %% "okhttp-backend" % "4.0.0-M15"
```

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-M14"
"com.softwaremill.sttp.client4" %% "armeria-backend" % "4.0.0-M15"
```

add imports:
Expand Down
6 changes: 3 additions & 3 deletions generated-docs/out/backends/http4s.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M14" // for cats-effect 3.x & http4s 1.0.0-Mx
"com.softwaremill.sttp.client4" %% "http4s-backend" % "4.0.0-M15" // for cats-effect 3.x & http4s 1.0.0-Mx
// or
"com.softwaremill.sttp.client4" %% "http4s-ce2-backend" % "4.0.0-M14" // for cats-effect 2.x & http4s 0.21.x
"com.softwaremill.sttp.client4" %% "http4s-ce2-backend" % "4.0.0-M15" // for cats-effect 2.x & http4s 0.21.x
```

The backend can be created in a couple of ways, e.g.:
Expand Down Expand Up @@ -35,6 +35,6 @@ Please note that:

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.

The backend supports streaming using fs2. For usage details, see the documentation on [streaming using fs2](fs2.md#streaming).
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).
12 changes: 6 additions & 6 deletions generated-docs/out/backends/javascript/fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M14"
"com.softwaremill.sttp.client4" %%% "core" % "4.0.0-M15"
```

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-M14"
"com.softwaremill.sttp.client4" %%% "monix" % "4.0.0-M15"
```

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-M14"
"com.softwaremill.sttp.client4" %%% "zio" % "4.0.0-M15"
```

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-M14"
"com.softwaremill.sttp.client4" %%% "cats" % "4.0.0-M15"
```

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

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-M14"
"com.softwaremill.sttp.client4" %%% "monix" % "4.0.0-M15"
```

An example of streaming a response:
Expand Down
6 changes: 3 additions & 3 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-M14"
"com.softwaremill.sttp.client4" %% "monix" % "4.0.0-M15"
```

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

Create the backend using:
Expand All @@ -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-M14"
"com.softwaremill.sttp.client4" %% "armeria-backend-monix" % "4.0.0-M15"
```

add imports:
Expand Down
2 changes: 1 addition & 1 deletion generated-docs/out/backends/native/curl.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M14"
"com.softwaremill.sttp.client4" %%% "core" % "4.0.0-M15"
```

and initialize one of the backends:
Expand Down
2 changes: 1 addition & 1 deletion generated-docs/out/backends/pekko.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M14"
"com.softwaremill.sttp.client4" %% "pekko-http-backend" % "4.0.0-M15"
```

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.
Expand Down
2 changes: 1 addition & 1 deletion generated-docs/out/backends/scalaz.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M14"
"com.softwaremill.sttp.client4" %% "armeria-backend-scalaz" % "4.0.0-M15"
```

add imports:
Expand Down
6 changes: 0 additions & 6 deletions generated-docs/out/backends/summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ Class Effect type Supported stream t
================================ ============================ ========================================= ===================
```

Finally, there are third-party backends:

* [sttp-play-ws](https://github.com/scalamania/sttp-play-ws) for "standard" play-ws (not standalone).
* [akkaMonixSttpBackend](https://github.com/fullfacing/akkaMonixSttpBackend), an Akka-based backend, but using Monix's `Task` & `Observable`.
* [be-kind-rewind](https://github.com/reibitto/be-kind-rewind), a VCR testing library for Scala

## Backend types

Depending on the capabilities that a backend supports, the exact backend type differs:
Expand Down
6 changes: 3 additions & 3 deletions generated-docs/out/backends/synchronous.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M14"
"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M15"
```

Create the backend using:
Expand Down Expand Up @@ -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-M14"
"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M15"
```

Create the backend using:
Expand All @@ -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-M14"
"com.softwaremill.sttp.client4" %% "okhttp-backend" % "4.0.0-M15"
```

Create the backend using:
Expand Down
10 changes: 4 additions & 6 deletions generated-docs/out/backends/wrappers/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Handling retries is a complex problem when it comes to HTTP requests. When is a
* only idempotent HTTP methods (such as `GET`) could potentially be retried
* some HTTP status codes might also be retryable (e.g. `500 Internal Server Error` or `503 Service Unavailable`)

In some cases it's possible to implement a generic retry mechanism; such a mechanism should take into account logging, metrics, limiting the number of retries and a backoff mechanism. These mechanisms could be quite simple, or involve e.g. retry budgets (see [Finagle's](https://twitter.github.io/finagle/guide/Clients.md#retries) documentation on retries). In sttp, it's possible to recover from errors using the `monad`. A starting point for a retrying backend could be:
In some cases it's possible to implement a generic retry mechanism; such a mechanism should take into account logging, metrics, limiting the number of retries and a backoff mechanism. These mechanisms could be quite simple, or involve e.g. retry budgets (see [Finagle's](https://twitter.github.io/finagle/guide/Clients.html#retries) documentation on retries). In sttp, it's possible to recover from errors using the `monad`. A starting point for a retrying backend could be:

```scala
import sttp.capabilities.Effect
Expand Down Expand Up @@ -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-M14" % Test classifier "tests"
"com.softwaremill.sttp.client4" %% "core" % "4.0.0-M15" % Test classifier "tests"
```

Implement your backend and extend the `HttpTest` class:
Expand All @@ -277,8 +277,6 @@ class MyCustomBackendHttpTest extends HttpTest[Future] {
}
```

You can find a more detailed example in the [sttp-vertx](https://github.com/guymers/sttp-vertx) repository.

## Custom backend wrapper using cats

When implementing a backend wrapper using cats, it might be useful to import:
Expand All @@ -290,9 +288,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-M14" // for cats-effect 3.x
"com.softwaremill.sttp.client4" %% "cats" % "4.0.0-M15" // for cats-effect 3.x
// or
"com.softwaremill.sttp.client4" %% "catsce2" % "4.0.0-M14" // for cats-effect 2.x
"com.softwaremill.sttp.client4" %% "catsce2" % "4.0.0-M15" // for cats-effect 2.x
```

The object contains implicits to convert a cats `MonadError` into the sttp `MonadError`,
Expand Down
6 changes: 3 additions & 3 deletions generated-docs/out/backends/wrappers/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ 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-M14"
"com.softwaremill.sttp.client4" %% "slf4j-backend" % "4.0.0-M15"
```

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).
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.x/log4j-slf4j-impl.html).

Example usage:

Expand All @@ -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-M14"
"com.softwaremill.sttp.client4" %% "scribe-backend" % "4.0.0-M15"
```
6 changes: 3 additions & 3 deletions generated-docs/out/backends/wrappers/opentelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-M14"
"com.softwaremill.sttp.client4" %% "opentelemetry-metrics-backend" % "4.0.0-M15"
```

Then an instance can be obtained as follows:
Expand Down Expand Up @@ -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-M14" // for ZIO 2.x
"com.softwaremill.sttp.client4" %% "opentelemetry-tracing-zio-backend" % "4.0.0-M15" // for ZIO 2.x
```

This backend depends on [zio-opentelemetry](https://github.com/zio/zio-telemetry).
Expand All @@ -77,7 +77,7 @@ val tracing: Tracing = ???
OpenTelemetryTracingZioBackend(zioBackend, tracing)
```

By default, the span is named after the HTTP method (e.g "HTTP POST") as [recommended by OpenTelemetry](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#name) for HTTP clients,
By default, the span is named after the HTTP method (e.g "HTTP POST") as [recommended by OpenTelemetry](https://opentelemetry.io/docs/specs/semconv/http/http-metrics/#http-client) for HTTP clients,
and the http method, url and response status codes are set as span attributes.
You can override these defaults by supplying a custom `OpenTelemetryZioTracer`.

Expand Down
Loading

0 comments on commit 3432ec5

Please sign in to comment.