Skip to content

Add SetRawQueryString to preserve query parameter order#296

Draft
Copilot wants to merge 2 commits intodevelopfrom
copilot/disable-query-parameter-reordering
Draft

Add SetRawQueryString to preserve query parameter order#296
Copilot wants to merge 2 commits intodevelopfrom
copilot/disable-query-parameter-reordering

Conversation

Copy link
Copy Markdown

Copilot AI commented Dec 4, 2025

Query parameters are alphabetically sorted by url.Values.Encode(), which breaks APIs requiring specific parameter ordering for signature generation.

Changes

  • Add RawQueryString field to SuperAgent struct
  • Add SetRawQueryString() method that bypasses url.Values.Encode() sorting
  • Update Clone() and ClearSuperAgent() to handle new field
  • Update MakeRequest() to use raw query string when set (takes precedence over QueryData)

Usage

// Parameters sent exactly as provided: z=last&a=first&m=middle
gorequest.New().
    Get("http://example.com/api").
    SetRawQueryString("z=last&a=first&m=middle").
    End()

// For JSON body order, use Send() with raw JSON string (already supported):
gorequest.New().
    Post("http://example.com/api").
    Send(`{"z":"last","a":"first"}`).
    End()

Note: Pre-existing flaky TestTimeoutFunc failure is unrelated to these changes.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://github.com:80/parnurzeal/gorequest
    • Triggering command: /tmp/go-build3060034973/b001/gorequest.test /tmp/go-build3060034973/b001/gorequest.test -test.paniconexit0 -test.v=true -test.count=1 -test.timeout=1m0s (http block)
    • Triggering command: /tmp/go-build1464979024/b001/gorequest.test /tmp/go-build1464979024/b001/gorequest.test -test.paniconexit0 -test.v=true -test.count=1 -test.timeout=2m0s 0.1-go1.25.5.lin. 0.1-go1.25.5.lin-imultiarch rg/toolchain@v0.x86_64-linux-gnu (http block)
    • Triggering command: /tmp/go-build1673557111/b001/gorequest.test /tmp/go-build1673557111/b001/gorequest.test -test.paniconexit0 -test.count=1 -test.timeout=2m0s (http block)
  • www.google.com
    • Triggering command: /tmp/go-build3060034973/b001/gorequest.test /tmp/go-build3060034973/b001/gorequest.test -test.paniconexit0 -test.v=true -test.count=1 -test.timeout=1m0s (dns block)
    • Triggering command: /tmp/go-build1464979024/b001/gorequest.test /tmp/go-build1464979024/b001/gorequest.test -test.paniconexit0 -test.v=true -test.count=1 -test.timeout=2m0s 0.1-go1.25.5.lin. 0.1-go1.25.5.lin-imultiarch rg/toolchain@v0.x86_64-linux-gnu (dns block)
    • Triggering command: /tmp/go-build1673557111/b001/gorequest.test /tmp/go-build1673557111/b001/gorequest.test -test.paniconexit0 -test.count=1 -test.timeout=2m0s (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>why this package always reordering alphabetical query parameter or body json? i need disabled it</issue_title>
<issue_description>how to disabled reordering query parameter or body? i need it for signature</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: parnurzeal <841616+parnurzeal@users.noreply.github.com>
Copilot AI changed the title [WIP] Disable reordering of alphabetical query parameters Add SetRawQueryString to preserve query parameter order Dec 4, 2025
Copilot AI requested a review from parnurzeal December 4, 2025 01:25
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.

why this package always reordering alphabetical query parameter or body json? i need disabled it

2 participants