package nova.monadic_sfx.http.requests import nova.monadic_sfx.AppTypes import nova.monadic_sfx.AppTypes.HttpBackend import monix.eval.Task import sttp.client._ import sttp.client.circe._ import io.circe.generic.auto._ import nova.monadic_sfx.models._ import cats.data.EitherT class DummyRequest(backend: HttpBackend) extends AppTypes { private implicit val _backend = backend def send() = { Task .suspend { for { req <- basicRequest .get(uri"https://httpbin.org/get") .response(asJson[HttpBinResponse]) .send() } yield (req) } } def test() = { for { res <- send() res3 <- Task { res.body } res2 <- Task { res3.fold( err => { err.toString() }, value => value.toString() ) } } yield (res3) } }