Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active May 25, 2024 10:19
Show Gist options
  • Save dacr/d7fc9d8f8607f0adebda553dfe185bff to your computer and use it in GitHub Desktop.
Save dacr/d7fc9d8f8607f0adebda553dfe185bff to your computer and use it in GitHub Desktop.
Simplest sttp http client library example. / published by https://github.com/dacr/code-examples-manager #f1d1b2f8-1ddf-4f17-9afa-4dc80c8b7c92/a4f9afb9cb70ce8086b9be001d5dcb77698949c
// summary : Simplest sttp http client library example.
// keywords : scala, sttp, http-client, @testable
// publish : gist
// authors : David Crosson
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
// id : f1d1b2f8-1ddf-4f17-9afa-4dc80c8b7c92
// created-on : 2019-05-19T16:59:54Z
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// ---------------------
//> using scala "3.4.2"
//> using dep "com.softwaremill.sttp.client3::core:3.7.0"
// ---------------------
import sttp.client3.*
println(
quickRequest
.get(uri"http://mapland.fr/ip")
.response(asStringAlways)
.send(quick.backend)
.body
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment