Skip to content

fix: correct URL and query string building edge cases - #2137

Merged
ChrisPulman merged 1 commit into
mainfrom
fix/url-query-building
Jun 17, 2026
Merged

ChrisPulman merged 1 commit into
mainfrom
fix/url-query-building

Conversation

@glennawatson

Copy link
Copy Markdown
Contributor

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 RequestBuilderImplementation request construction.

What is the new behavior?

What is the current behavior?

  • A CultureInfo query parameter is treated as a complex object and recursed into. Because CultureInfo exposes a self-referencing Parent, this recurses without bound and throws a StackOverflowException.
  • A base address ending with a slash is concatenated with a route that already starts with a slash, producing a double slash in the path.
  • Path-bound properties are matched against the parameter's declared type by PropertyInfo reference. For a derived runtime instance the inherited property is a different PropertyInfo, so the match fails and the path property is duplicated into the query string.

What might this PR break?

None expected. CultureInfo and 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

  • I have read the Contribute guide
  • Tests have been added or updated (for bug fixes / features)
  • Docs have been added or updated (for bug fixes / features)
  • Changes target the main branch
  • PR title follows Conventional Commits

Additional information

New unit tests cover the CultureInfo and trailing-slash cases; the existing GetWithDerivedObjectAsBaseType integration test now asserts that the path-bound property is not duplicated into the query.

- 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
ChrisPulman merged commit 7a3489e into main Jun 17, 2026
5 checks passed
@ChrisPulman
ChrisPulman deleted the fix/url-query-building branch June 17, 2026 06:22
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

2 participants