Repository navigation
fix: correct URL and query string building edge cases - #2137
Merged
Merged
Conversation
- CultureInfo query parameters no longer cause a stack overflow; the value is now formatted as a leaf rather than recursed into via its self-referencing Parent property. Closes #1323. - A base address that ends with a slash no longer produces a double slash in the request URL, since every path fragment is already prefixed with a slash. Closes #1358. - A property bound to the URL path is no longer duplicated as a query parameter when a derived instance is passed for a base-typed parameter; path properties are now matched by name instead of by PropertyInfo reference. Closes #1882.
ChrisPulman
approved these changes
Jun 17, 2026
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 kind of change does this PR introduce?
Bug fixes for URL and query string building. Three small, independent fixes grouped together as they all touch
RequestBuilderImplementationrequest construction.What is the new behavior?
CultureInfoquery parameter is formatted as a leaf value (for example?culture=en-US) instead of being reflected into. Closes [BUG] Using of a CultureInfo parameter leads to a stack overflow. #1323.http://host/api/) produces a single slash before the route, so the request URL is/api/foorather than/api//foo. Closes Refit requires base address of supplied HttpClient to not end with a slash #1358.What is the current behavior?
CultureInfoquery parameter is treated as a complex object and recursed into. BecauseCultureInfoexposes a self-referencingParent, this recurses without bound and throws aStackOverflowException.PropertyInforeference. For a derived runtime instance the inherited property is a differentPropertyInfo, so the match fails and the path property is duplicated into the query string.What might this PR break?
None expected.
CultureInfoand trailing-slash base addresses previously failed or produced malformed URLs. The derived-type change only removes a duplicated query parameter; the existing test for that scenario has been updated to assert the corrected behavior.Checklist
mainbranchAdditional information
New unit tests cover the
CultureInfoand trailing-slash cases; the existingGetWithDerivedObjectAsBaseTypeintegration test now asserts that the path-bound property is not duplicated into the query.