-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attaching HandlerAspect to a Routes object with mulitple dependencies does not work (using Scala2) #3112
Labels
Comments
/bounty $150 for fix and test |
💎 $150 bounty • ZIOSteps to solve:
Thank you for contributing to zio/zio-http! Add a bounty • Share on socials
|
/attempt #3112 Options |
/attempt #3112
|
💡 @pawelsadlo submitted a pull request that claims the bounty. You can visit your bounty board to reward. |
🎉🎈 @pawelsadlo has been awarded $150! 🎈🎊 |
I'm still running into this with zio-http 3.0.1, needing to resort to the previous workaround: type Env = UploadService with AuthInterceptor
val withViewer = Middleware.customAuthProvidingZIO[AuthInterceptor, Viewer](req =>
(for {
interceptor <- ZIO.service[AuthInterceptor]
viewer <- interceptor.intercept(req)
} yield Some(viewer))
val routes = API.upload.@@[Env](withViewer) or otherwise it fails with:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The operator '@@' is used to attach a HandlerAspect to a Routes object.
It is working fine if applying results in a Routes object with no dependencies.
If the result is a Routes object with one dependency, it still works, but that dependency needs to be declared explicitly, like:
.@@[Int]
However if the result is a Routes object with multiple dependencies, it won't work even if we declare those dependencies explicitly.
Using scala 3 everything works as expected, and the type does not need to be declared explicitly either.
Example code to reproduce the issue:
The text was updated successfully, but these errors were encountered: