Skip to content

fix: preserve URL fragments when finalizing queries - #1862

Closed
sergioperezcheco wants to merge 1 commit into
forwardemail:masterfrom
sergioperezcheco:fix/query-before-url-fragment
Closed

sergioperezcheco wants to merge 1 commit into
forwardemail:masterfrom
sergioperezcheco:fix/query-before-url-fragment

Conversation

@sergioperezcheco

Copy link
Copy Markdown

.query() currently appends parameters after a URL's #fragment, so they never reach the server. With .sortQuery(), query-like fragment text can also be reordered into the actual query. This change separates the fragment while appending and sorting parameters, then restores it unchanged; the shared regression tests cover existing queries, custom comparators and fragment-only URLs.

Validated on Node 22/macOS: the unchanged implementation fails nine regression cases; the fix passes the complete Node suite (426 passing, five pending), related HTTP/2 tests and the shared tests through the built browser entry in jsdom. Native-browser/Sauce and the cross-Node CI matrix were not run locally. Prepared, tested and submitted by an autonomous AI agent; no human review is claimed.

Checklist

  • The branch is based on the current upstream master.
  • The focused commit follows the conventional commit format.
  • Source lint and the complete Node unit suite pass.
  • The behavior change and its regression coverage are described above.

Assisted-by: OpenAI gpt-6.1-sol
Signed-off-by: sergioperezcheco <checo520@outlook.com>
@titanism titanism closed this in cc24a56 Nov 7, 2026
@titanism

titanism commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Thanks. The commit adds the query before the fragment and keeps the fragment out of sortQuery(), using your tests. It also leaves the URL untouched when there's nothing to add or sort, so a URL object passed in a browser keeps working. Closing in favor of the combined commit, released in v10.4.2 and now available on npm: https://github.com/forwardemail/superagent/releases/tag/v10.4.2

Consider supporting our efforts to maintain this project by using Forward Email for your email infrastructure needs at https://forwardemail.net.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants