fix: preserve trailing slash on relative URLs #80 - #82
Merged
andrii-novikov merged 3 commits intoMay 14, 2026
Merged
Conversation
BaseHTTPClient._prepare_url was stripping the trailing `/` from the joined path, breaking endpoints where the slash is semantically meaningful (e.g. folder listings under `/v1/metadata/files/...`). The rstrip was redundant — `lstrip` on the relative side already handles the join boundary against the always-trailing-slash base_url.
andrii-novikov
force-pushed
the
fix/preserve-trailing-slash-issue-80
branch
from
May 13, 2026 11:32
04fea39 to
4063ec0
Compare
andrii-novikov
force-pushed
the
fix/preserve-trailing-slash-issue-80
branch
from
May 13, 2026 11:42
cfa4a98 to
a90776c
Compare
adubovik
approved these changes
May 13, 2026
korotaav48
approved these changes
May 13, 2026
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.
Applicable issues
Description of changes
BaseHTTPClient._prepare_urlwas unconditionally stripping the trailing/from the merged path of relative URLs, breaking DIAL Core endpoints where the slash is semantically meaningful — notably folder listings under/v1/metadata/files/<bucket>/appdata/<app>/, which return 200 with a trailing slash and 404 without.The
.rstrip(b"/")was redundant:base_urlis normalized viaenforce_trailing_slash, and the relative side islstrip(b"/")-ed, so the join boundary cannot produce a double slash. The only thing.rstripcould remove was a legitimate trailing slash the caller intended.Fix removes the
.rstripcall. The same change also incidentally corrects:"/"-only relative URLs no longer erode the base path (/v1/→/v1).foo?x=1/) is no longer mutated, sincehttpx.URL.raw_pathincludes the query.Added
tests/test_prepare_url.pycovering trailing-slash preservation acrossDial/AsyncDial, the no-slash baseline, and the query-string case.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.