zio / zio-http

A next-generation Scala framework for building scalable, correct, and efficient HTTP clients and servers
https://zio.dev/zio-http
Apache License 2.0
787 stars 396 forks source link

Improve ZClient UX with regards to Scope #2957

Closed 987Nabil closed 1 month ago

987Nabil commented 2 months ago

Currently the Client requires a scope to close some kinds of bodies. The user has to wrap his code in ZIO.scoped to avoid memory leaks (which is also not documented well). From a users perspective, this is not needed most of the time. He probably just wants to handle the body directly and clean up the request. We should have a simpler API that does not require an explicit scope. We can let the user handover a function, that handles the response and after its execution we just clean up for the user.

This should not replace the current more powerful API, but should be promoted as the default in documentation. For the current docs, we need to move away from using the global scope and should change most examples to this new API.

cc @kyri-petrou

jdegoes commented 2 months ago

/bounty $250

algora-pbc[bot] commented 2 months ago

💎 $250 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #2957 with your implementation plan
  2. Submit work: Create a pull request including /claim #2957 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio-http!

Add a bounty • Share on socials

Attempt Started (GMT+0) Solution
🟢 @kyri-petrou Aug 7, 2024, 2:05:04 PM #3008
kyri-petrou commented 2 months ago

/attempt #2957

Algora profile Completed bounties Tech Active attempts Options
@kyri-petrou    23 ZIO bounties
+ 2 bounties from 1 project
Scala, Python,
Shell & more
Cancel attempt
algora-pbc[bot] commented 1 month ago

🎉🎈 @kyri-petrou has been awarded $250! 🎈🎊