<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.13.6</version>
</dependency>
<dependency>
<groupId>com.softwaremill.sttp.client3</groupId>
<artifactId>core_2.13</artifactId>
<version>3.3.16</version>
</dependency>
scala
import sttp.client3._
object ScalaHttpClientExample {
def main(args: Array[String]): Unit = {
val response = basicRequest.get(uri"https://api.example.com/user/1").send()
println(response.body)
}
}
scala
import sttp.client3._
object ScalaHttpClientExample {
def main(args: Array[String]): Unit = {
val request = basicRequest.get(uri"https://api.example.com/user/1").readTimeout(Duration(5000, "ms"))
val response = request.send()
println(response.body)
}
}
[https://github.com/example/repository](https://github.com/example/repository)