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 prefix method to Route/Routes #2547

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

987Nabil
Copy link
Contributor

@987Nabil 987Nabil commented Dec 8, 2023

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Dec 8, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (58e0594) 64.28% compared to head (ecfe87b) 64.22%.

Files Patch % Lines
zio-http/src/main/scala/zio/http/Route.scala 12.50% 7 Missing ⚠️
zio-http/src/main/scala/zio/http/Routes.scala 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2547      +/-   ##
==========================================
- Coverage   64.28%   64.22%   -0.06%     
==========================================
  Files         138      138              
  Lines        7977     7987      +10     
  Branches     1483     1471      -12     
==========================================
+ Hits         5128     5130       +2     
- Misses       2849     2857       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -120,6 +119,16 @@ sealed trait Route[-Env, +Err] { self =>
*/
def location: Trace

def prefix(prefix: PathCodec[Unit])(implicit ev: Err <:< Response): Route[Env, Err] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be called nest, because it nests routes under a path prefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what you say is not wrong, but I find prefix more intuitive. Akka http calls it pathPrefix in their routing api, play has SimpleRouter#withPrefix. I think prefix is quite right.

Copy link
Member

@jdegoes jdegoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny comment on naming, otherwise looks great!

@987Nabil 987Nabil force-pushed the prefix-route-middleware branch 3 times, most recently from 7adf00f to 0bed16a Compare December 18, 2023 21:35
@987Nabil 987Nabil merged commit d1e87cb into zio:main Dec 20, 2023
14 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