sttp supports read and connection timeouts:

  • Connection timeout - can be set globally (30 seconds by default)

  • Read timeout - can be set per request (1 minute by default)

How to use:

import sttp.client4._
import scala.concurrent.duration._

// all backends provide a constructor that allows to specify backend options
val backend = DefaultSyncBackend(
  options = BackendOptions.connectionTimeout(1.minute))

  .readTimeout(5.minutes) // or Duration.Inf to turn read timeout off