Repository navigation
assert: preserve URL queries when HTTP status parameters are empty - #2001
Open
JunaidAhamed-7777 wants to merge 1 commit into
Open
JunaidAhamed-7777 wants to merge 1 commit into
JunaidAhamed-7777 wants to merge 1 commit into
Conversation
Keep existing query strings for nil or empty values. Preserve nonempty parameter replacement behavior and cover both helper and public assertion regressions. AI-assisted implementation, testing, and automated review.
JunaidAhamed-7777
marked this pull request as ready for review
October 31, 2026 06:11
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
Preserve queries already present in the target URL when HTTP status assertions receive nil or empty
url.Values.Changes
req.URL.RawQuerywhen the separate values map is nonempty.url.Values{"q": nil}, which encodes to an empty string and clears the query.HTTPStatusCoderegression.Motivation
A handler requiring
q=hello worldcurrently receives no query from:That can make an assertion exercise a different request than its caller supplied. This intentionally corrects nil/empty-parameter behavior; exported signatures remain unchanged. It aligns this case with
HTTPBody, but does not modifyHTTPBodyor introduce query merging.Related issues
No matching open issue or competing open PR found. Closed PR #1988 concerns a different helper,
HTTPBody; this change is limited to HTTP status assertions.Validation
Against master
87a7b9d57689f6579db2da795ab8deeab29cb724, using Go 1.27.3 on linux/amd64:go test -p 2 -race -count=1 ./...passes.go vet -p 2 ./...andgo generate ./...pass; generation leaves no extra changes.git diff --checkpass.AI-assisted using GPT-6 Astra