fix: auto-sanitize TX_POOL_URL trailing slash#224
Merged
Conversation
Automatically ensures TX_POOL_URL has a trailing slash during config sanitization, fixing url.join() behavior for endpoint construction. - Add sanitize() method to BuilderConfig - Apply sanitization on config load in config_from_env() - Remove manual trailing slash requirement from README - Add 6 unit tests for URL sanitization Closes ENG-1531
Member
|
@init4samwise CI is broken |
The test url_without_trailing_slash_gets_sanitized was incorrectly asserting that parsing "http://localhost:9000" would give a URL without a trailing slash. Per URL spec, a URL without an explicit path gets the root path "/", which DOES end with a slash. Renamed test to root_url_already_has_trailing_slash and updated assertions to document this behavior correctly - the sanitization is actually a no-op for root URLs since they already have the trailing slash.
prestwich
approved these changes
Feb 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.
Summary
Automatically ensures
TX_POOL_URLhas a trailing slash during config sanitization, fixingurl.join()behavior for endpoint construction.Problem
The Rust
url.join()method behaves differently depending on whether the base URL ends with a trailing slash:http://example.com/api/+join("transactions")=http://example.com/api/transactions✅http://example.com/api+join("transactions")=http://example.com/transactions❌This caused a confusing requirement in the README for users to manually add trailing slashes.
Solution
sanitize()method toBuilderConfigthat ensures trailing slashconfig_from_env()Testing
Added unit tests covering:
url.join()works correctly after sanitizationCloses ENG-1531