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

Base URL doesn’t do what it’s supposed to #19

Open
andrewshadura opened this issue Oct 20, 2019 · 0 comments
Open

Base URL doesn’t do what it’s supposed to #19

andrewshadura opened this issue Oct 20, 2019 · 0 comments

Comments

@andrewshadura
Copy link

I’m very new to Rust so maybe I’m misunderstanding something, but I have a feeling the base URL logic isn’t quite right.

My initial understanding was that specifying the base URL would automatically put all of the URLs in the service’s methods under its namespace, e.g. so if the base URL is "/rest/v1" and the method has GET("/test"), the resulting URL would be /rest/v1/test. However, since you use Url::join for this purpose, the leading slash in the method’s URL acts as an absolute path signifier, resetting the URL to /test. If I remove this leading slash, it still doesn’t work as expected since the base URL doesn’t have a trailing slash, so Url::join removes the trailing path component and then appends the other URL, resulting in /rest/test. While this makes sense for URLs in general, I find this quite confusing in this context and counter-intuitive. My current work-around was to drop the path from the base URL and to add .chain_interceptor(PrependUrl("/rest/v1")) to the Adapter builder chain.

Would you consider changing the implementation to avoid this confusing behaviour?

Thanks!

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

1 participant