-
Notifications
You must be signed in to change notification settings - Fork 412
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
[Bug] The passed Env
is not the good one
#3066
Comments
Do you happen to know if this an issue only of the TestServer or does it also affect the "real" server implementation? |
I don't know. I can try to reproduce it in my app 🤔 |
I might be wrong but I'm thinking that in an app the usage pattern would be a bit different, probably it'd require a middleware to provide the env? Unless you're adding apps to the server dynamically that's it |
/bounty $250 |
💎 $250 bounty • ZIOSteps to solve:
Thank you for contributing to zio/zio-http! Add a bounty • Share on socials
|
/attempt #3066 I'd like to take a look at this
|
This Bug is not technically a bug but an unfortunate behaviour of the addRoutes call.
Which in itself is not wrong, because the second call to
If we flip this here to say @jdegoes I'd be happy to submit a tiny PR to flip this and make it work as expected. |
@exi Go for it :) |
💡 @exi submitted a pull request that claims the bounty. You can visit your bounty board to reward. |
In case of duplicate routes, the old logic gives precedence to older routes, which breaks cases where the routes are updated with new environments and re-added. This gives precedence to the newer ones. /claim zio#3066
I just found this comment: zio-http/zio-http/shared/src/main/scala/zio/http/Routes.scala Lines 50 to 57 in 502331c
It seems like it's the intended behaviour to have old routes take precendence. So this test case here is (sadly) working as intended as long as you are not replacing the |
Gentle ping. |
@guizmaii do you have any idea what's going on with this bounty? It has not been responded to for months. |
Reproducer:
The test will fail on the second iteration of the
check
with the following assertion error:The
Env
of theapi
handler is never updated. It always contains the instance ofMyService
returning1
This is quite a nasty bug.
Cc @jdegoes @987Nabil
The text was updated successfully, but these errors were encountered: