Skip to content
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

Add context method to request context #2799

Merged
merged 2 commits into from
Apr 27, 2024
Merged

Add context method to request context #2799

merged 2 commits into from
Apr 27, 2024

Conversation

987Nabil
Copy link
Contributor

@987Nabil 987Nabil commented Apr 24, 2024

@jdegoes rfc

@987Nabil 987Nabil requested review from jdegoes and vigoo as code owners April 24, 2024 20:21
@987Nabil 987Nabil force-pushed the context branch 3 times, most recently from 8d15a16 to 5650975 Compare April 25, 2024 06:09
@guersam
Copy link
Contributor

guersam commented Apr 25, 2024

It seems like a DX improvement with a function that can replace ZIO.service[A] with a shorthand, revealing the intention more clearly. Nice to see this addition!

My two cents: context tends to be used much more frequently in user land code than handler, so exposing zio.http.context via import zio.http.* might cause unwanted shadowing. I'd prefer useContext or withContext.

@jdegoes
Copy link
Member

jdegoes commented Apr 25, 2024

@987Nabil Looks good! Maybe we can call the function withContext instead of context? Matches the name of the type class too.

@987Nabil
Copy link
Contributor Author

@jdegoes done

@jdegoes jdegoes merged commit d283e07 into zio:main Apr 27, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants