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

String to Uri #434

Open
benkio opened this issue Nov 3, 2021 · 3 comments
Open

String to Uri #434

benkio opened this issue Nov 3, 2021 · 3 comments

Comments

@benkio
Copy link

benkio commented Nov 3, 2021

I'm trying this method

def healthCheckRoutes[F[_]: Monad, H[_]: Reducible](
healthCheck: HealthCheck[F, H],
path: String = "health-check"
)(

and I found that, overriding the path field, I can't put the health check route endpoint far from the root of the service, eg:

  • "healthCheckFoo": resulting in localhost/myHealthcheck works, 200
  • "bar/healthCheckFoo": doesn't work, 404

I think the parameter type should change, from String to Uri

@kubukoz
Copy link
Owner

kubukoz commented Nov 3, 2021

hmm Uri has the problem that it could be absolute. While I agree the current state is problematic, I'm not convinced that's the best solution. Maybe a list of segments instead?

A workaround at the moment would be to wrap these routes in Router to add extra segments. e.g. Router("bar" -> healthCheckRoutes(..., "healthCheckFoo")).

@rossabaker what do you think about using Uri in this case?

@rossabaker
Copy link

A Uri.Path is basically just a Vector of segments that may or may not be absolute. Even if it is absolute, you can ignore that and append it to some other prefix. And you won't have schemes, authorities, etc. to discard.

@kubukoz
Copy link
Owner

kubukoz commented Nov 3, 2021

oh, Uri.Path sounds great then. Thanks!

I'd add that, but keep the existing signature as well.

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

No branches or pull requests

3 participants