Skip to content

Support ordered form data #391

Closed
Closed
@rosahaj

Description

At the moment form data is always sorted alphabetically, because map and net/url.Values sort keys alphabetically (see this issue). However, most browsers send form data in the order in which it appears in the submitted form. This poses an issue when attempting to mimic browser behavior (using client.ImpersonateChrome or client.ImpersonateFirefox) as alphabetically ordered form data can be detected as anomalous, particularly when every other request is honoring the original form order.

My suggestion would be to add request.SetOrderedFormData and client.SetCommonOrderedFormData methods, which accept an ordered map (for example this one) as an argument and set the OrderedFormData field of the request or client respectively. Unfortunately this could create confusion over whether FormData or OrderedFormData takes precedence when both are set. Changing the type of the FormData field from net/url.Values to an ordered map would solve this problem, but would break things for anyone relying on FormData to be of the type net/url.Values.

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions