23 questions
3
votes
1
answer
75
views
Prefix many ZIO-HTTP Endpoint Declarations with "api"
I use the ZIO-http declarative Endpoints, and I love that docs can be generated from them. I want to add a prefix ("api") to all of the endpoints, but I don't want to go through each ...
1
vote
1
answer
104
views
How do you pass any type of object from the CtxOut in a HandlerAspect down to a Handler?
This question is adjacent to this question but not completely as my zio-http implementation is a bit more involved, making this quite a bit more tricky.
The question is the same: how do I pass any ...
1
vote
0
answers
156
views
zio-http, access to Request object inside of implementHandler
In ZIO http, I defined an Endpoint, and write an implementation. In the implementation, I need to access Request object, as shown in the toy example below:
object MyEndpoint extends ZIOAppDefault {
...
2
votes
0
answers
167
views
How to handle error for web service in Endpoint in zio-http-3
I am writing a web service using Zio Http 3, but I have a problem of handling error, because registerEndpoint.implement is a function zio.ZIO[Any, zio.ZNothing, String], not a Task.
final class ...
0
votes
1
answer
196
views
zio-http and Tapir: provide layers globally
Hello I'm starting a project with ZIO, zio-http, Tapir and Scala 3, I'm configuring ZLayers:
my routes:
object DeckRoute:
val deckRoutes: List[ZServerEndpoint[Any, Any]] =
List(
listRoute(...
0
votes
2
answers
363
views
Can't test ZIO HTTP client with exponential retry by advancing TestClock
I'm using ZIO HTTP 3.0.0-RC6 (transitively pulls ZIO 2.0.21, but I evict it manually by specifying ZIO version), ZIO and ZIO-test 2.1-RC1 with Scala 2.13. My suite looks like this (the point of the ...
3
votes
1
answer
398
views
Thread BLOCKED on InetAddress.getByName 0.0.0.0
I'm facing a situation where my application hangs at startup because of a "deadlock" situation related to InetAddress.getByName but it's not clear to me what would be the way to fix it.
To ...
0
votes
1
answer
446
views
Run ZIO Http server during ZIO tests
I have hard time understanding how to properly provide and kill the http server fiber.
Ideally I would want the tests to wait for the server to be ready to handle requests and later kill it. ...
4
votes
2
answers
233
views
How to get a value of HandlerAspect's `CtxOut` type in request processing
In zio-http, one has the option to write middleware that provide some sort of context around a request; as a concrete example, we might think of an auth middleware that looks up some package of ...
0
votes
1
answer
185
views
Using Guice as a dependency injection library in ZIO App
We are working on migrating our Play! application to ZIO. As a first step, we are checking if we can use the Google Guice as a dependency injection library in ZIO, so that changes could be minimal.
It ...
0
votes
3
answers
227
views
Upload json file from js frontend to zhttp backend
I have js code for upload json file with
content
{"name": "John", "age": 35}
from frontend js with using POST to scala zhttp backend.
JS code:
<script>
...
0
votes
1
answer
351
views
How to get access to the request payload in Tapir/ZIOHttp DefaultServerLog?
We build a REST microservice with Scala 3, ZIO 2, ZIO logging and Tapir.
For context specific logging we want to use the MDC and set an attribute there which is taken from the request payload.
Is it ...
1
vote
1
answer
1k
views
How to get zio.Runtime.default.unsafeRun available?
When i try call
zio.Runtime.default.unsafeRun(someStuff())
unsafeRun turns red so i cant call It
I need to take off all the wrappers and get a clean val from ZIO[R,E,A]
What should I import or\and ...
0
votes
1
answer
190
views
How to reserve ZIO response inside a custom method in
I have this method
import ClientServer.*
import zio.http.{Client, *}
import zio.json.*
import zio.http.model.Method
import zio.{ExitCode, URIO, ZIO}
import sttp.capabilities.*
import sttp.client3....
0
votes
1
answer
57
views
How to fix "T does not conform to bound <: AnyKind"?
I have the following ZIO project
object MinimalCounterexample extends ZIOAppDefault {
val fetch = {
for {
result <- Client.request("http://localhost:9123/whatever")
...