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

Support paths in base url #4

Closed
torbinsky opened this issue Jun 11, 2017 · 7 comments
Closed

Support paths in base url #4

torbinsky opened this issue Jun 11, 2017 · 7 comments
Assignees

Comments

@torbinsky
Copy link

Just had a bug that turned out to be caused by the base "url" effectively being a "base domain."

For example, if you set the base url to http://example.com/common/base/path and then call a method with a relative path of /relative/path the client will end up calling http://example.com/relative/path.

From my experience, it's pretty common for REST API's to have a common base url that includes path elements and it is also common for client implementations to accept common path elements in the base url.

I think it would be a lot more user-friendly and conventional to support path elements in the base url.

@bryanmacfarlane
Copy link
Contributor

Thanks for the feedback. I'll consider this.

@bryanmacfarlane bryanmacfarlane self-assigned this Jun 11, 2017
@kaeedo
Copy link
Contributor

kaeedo commented Jun 13, 2017

In my use case, I also need to do this. Would be nice to have as a config option. I'm willing to submit a PR if you want

@bryanmacfarlane
Copy link
Contributor

@keedo, PRs are welcome.

@bryanmacfarlane
Copy link
Contributor

Note that we're not stripping - the base url is the host portion of the url and then we add the relative paths. What it should do is if the "base url" has a path portion, it should save that off and then on every request pre-pend to the path given. Will need a bunch of tests for combinations ...

PRs welcome or I will get to soon.

@kaeedo
Copy link
Contributor

kaeedo commented Nov 21, 2017

Created PR for this: #23

@bryanmacfarlane bryanmacfarlane changed the title Client should not strip path from base URL Support paths in base url Dec 1, 2017
@bryanmacfarlane
Copy link
Contributor

done

@MadhuvanthG
Copy link

MadhuvanthG commented Mar 4, 2021

I'm using 1.8.1 and don't see that this issue has been fixed. Do we need to pass an additional param to preserve the path in baseURL? Looking at the code in the mentioned PR, looks like a flag was added and later removed to make this behavior (preserving path) the default one.

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

4 participants