Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active February 3, 2026 20:23
Show Gist options
  • Select an option

  • Save dacr/8f43b8c62207fc532092d38bf6d2cdb4 to your computer and use it in GitHub Desktop.

Select an option

Save dacr/8f43b8c62207fc532092d38bf6d2cdb4 to your computer and use it in GitHub Desktop.
ZIO learning - zhttp - simplest http client / published by https://github.com/dacr/code-examples-manager #6a32e396-78a2-4ed7-bef3-3f1a0e33b4c1/f10f5de015220376e775f7f36fb4ab44aafe5fac
// summary : ZIO learning - zhttp - simplest http client
// keywords : scala, zio, learning, pure-functional, zhttp, http-client, @testable
// publish : gist
// authors : David Crosson
// license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
// id : 6a32e396-78a2-4ed7-bef3-3f1a0e33b4c1
// created-on : 2021-04-04T17:33:20Z
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// ---------------------
//> using scala "3.4.2"
//> using dep "dev.zio::zio-http:3.0.0-RC1"
//> using dep "fr.janalyse::zio-worksheet:2.0.13.0"
// ---------------------
import zio.*, zio.worksheet.*, zio.http.*
val logic = for {
response <- Client.request("http://httpbin.org/get")
content <- response.body.asString
_ <- Console.printLine(content)
} yield ()
logic.provide(Client.default).unsafeRun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment