#sttp

[ follow ]
fromMedium
3 months ago

How to Develop a Native macOS Command-Line Tool Using Scala 3

//> using dep com.softwaremill.sttp.client3::core:3.10.3 import sttp.client3.quick.* import sttp.model.Uri val url = Uri.parse(args(0)).toOption.get def go(): Unit = { val getResult = simpleHttpClient.send(quickRequest.get(url)) if (getResult.code.isSuccess) { println("Success") } else { println("Failure, continue to try...") Thread.sleep(3000) go() } } go() This Scala script checks the availability of an HTTP service by continuously sending requests until it receives a successful response from the specified URL.
Scala
[ Load more ]