Last active
April 2, 2023 10:14
-
-
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/14f1dad986ead5818cf03e69c05bf46e3a20e2d8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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.2.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