fix: use full endpoint in api requests#292
Open
fztgreen-veteransunited wants to merge 6 commits intomia-platform:mainfrom
Open
fix: use full endpoint in api requests#292fztgreen-veteransunited wants to merge 6 commits intomia-platform:mainfrom
fztgreen-veteransunited wants to merge 6 commits intomia-platform:mainfrom
Conversation
Contributor
Author
|
Is this something we can support? It seems like a fairly large change to allow the full endpoint to be used in the api requests. |
Contributor
It is definitely an important change, but still a bugfix. It makes sense to me to use the complete endpoint instead of parsing the baseUrl without the chance to include it. Thanks for the proposed update. I'll start an internal review and - if everything is ok - we will merge this PR in a few days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR is for?
This PR fixes a bug where any path prefix set in the --endpoint configuration was silently discarded when building
request URLs.
When a user configured an endpoint with a path prefix (e.g. http://api-gateway/mia/), the prefix was stored correctly
in the config, but Request.URL() overwrote the full base path with the API path instead of appending to it:
// before
url.Path = r.apiPath
// after
url.Path = path.Join(url.Path, r.apiPath)
This caused all requests to be sent to the root of the host, ignoring the prefix entirely. For example, a project list
request with endpoint
http://gateway/mia/would go tohttp://gateway/api/backend/projects/instead ofhttp://gateway/mia/api/backend/projects/.