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