Repository navigation
fix(config): keep the base url path prefix when building request urls - #116
Merged
AntoniosBarotsis merged 2 commits intoOct 1, 2026
Merged
Conversation
Collaborator
|
Thanks! |
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.
Summary
Config::buildjoins the endpoint path onto the base url withUrl::join. Every endpoint path starts with/, sojointreats it as absolute and discards any path in the base url. A base url such ashttps://proxy.example.com/resend, set withConfigBuilder::base_urlorRESEND_BASE_URL, sendsGET /emailstohttps://proxy.example.com/emails.The
ConfigBuilder::base_urldocs describe pointing the client at a proxy, which commonly lives under a path prefix.This change appends a trailing slash to the base path when it is missing and joins the endpoint path without its leading slash. A base url without a path builds the same urls as before.
Testing
src/config.rsbuild request urls for a base url without a path, and for a base url with a path, with and without a trailing slash.blockingfeature.cargo fmt --checkandcargo clippy --all-targetsreport nothing for the changed file.Summary by cubic
Fixes
Config::buildso a path prefix in the base url is kept when building request urls. Previously a base url likehttps://proxy.example.com/resendsent requests tohttps://proxy.example.com/emailsbecauseUrl::jointreated the endpoint path as absolute and dropped the base path. Now the base path is preserved: trailing slashes are trimmed from it and the endpoint path is joined without its leading slash. Base urls without a path build the same urls as before, and tests cover both cases.Written for commit 42a4f5d. Summary will update on new commits.