mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #4889] [bug]: Random ordering of fields in multipart/form-data #1839
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#1839
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @emanuel-achirei-deel on GitHub (Mar 14, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4889
Originally assigned to: @CuriousCorrelation on GitHub.
Is there an existing issue for this?
Current behavior
When I send a multipart/form-data request, the fields always change their order.
Fields should keep the same order as defined in the request.
This is especially impactful for direct S3 uploads as the request fails if some fields are not in the proper order.
Steps to reproduce
Logs and Screenshots
Environment
Production
Hoppscotch Version
Cloud
Interceptor
Agent - Web App
Browsers Affected
Chrome
Operating System
MacOS
Additional Information
MacOS App version: Version 25.2.2 (20250312.111855)
@anwarulislam commented on GitHub (Mar 16, 2025):
Hi @emanuel-achirei-deel!
Couldn't reproduce the issue. Can you please send me a screenshot of the body you pass?
@emanuel-achirei-deel commented on GitHub (Mar 17, 2025):
@CuriousCorrelation commented on GitHub (Mar 20, 2025):
Hi @emanuel-achirei-deel, new release along with the new agent v0.1.7 and desktop app v25.2.3 are out, could you please check if it has resolved your issue?
@emanuel-achirei-deel commented on GitHub (Mar 26, 2025):
@CuriousCorrelation The issue doesn't seem to be fixed, I still get an error when sending the request about key parameter missing (due to it being after the file field) and as you can see in the screenshot, the order of the fields received by the server doesn't match the order in the request body.
@CuriousCorrelation commented on GitHub (Mar 26, 2025):
Hi @emanuel-achirei-deel, thank you for the update. I haven't been able to reproduce this behavior in my testing environment with the agent v0.1.7 or desktop app v25.2.3.
I would appreciate it very much if you could help troubleshoot this further by doing a quick test with an echo server that shows the exact order of
post_paramsandall_paramstogether.You can use this test requests (just paste into the URL input for easy import):
What we are looking for is the order of
all_paramsin the older version (unordered, randomized) vs. the new version (ordered, consistent).If these test requests show correct ordering but your specific request doesn't, it would be helpful to anonymize your data and try it with the echo server. This would help determine if the issue is with the form data handling in our application or if it might be related to middleware applied around the specific request. Thank you once more!
@emanuel-achirei-deel commented on GitHub (Mar 28, 2025):
Here's the results @CuriousCorrelation.
@CuriousCorrelation commented on GitHub (Mar 28, 2025):
Hi @emanuel-achirei-deel, thanks for the info. Good news is that I believe I've identified the issue and am working on a proper fix.
The problem previously was in how the
Mapstructure for serialization sometimes led to non-deterministic ordering. And even after the partial fix, there was an unexplored edge case where themap -> objflattening process introduced another source of unpredictability. JavaScript objects enumerate properties in a specific way - numeric keys first (sorted numerically), then string keys in insertion order. This is why you were seeing fields like "key" appearing at the end after ordered numeric values.I've completely refactored our approach to be more resilient to this and while the fix still needs to be testing across platforms and request type, from the limited amount of initial testing I did, the issue does seem to be resolved, and it should fix your S3 upload issues.
I'll try to include the fix in the upcoming patch release. Thank you for your patience and detailed testing - it was very helpful for tracking down this subtle but important issue!
@CuriousCorrelation commented on GitHub (Apr 10, 2025):
Hi @emanuel-achirei-deel, the latest release
v2025.3.1is out, let me know if the patch has worked for you!@emanuel-achirei-deel commented on GitHub (Apr 16, 2025):
@CuriousCorrelation just verified, looks to be working, thanks for the fix!
@CuriousCorrelation commented on GitHub (Apr 16, 2025):
@emanuel-achirei-deel Perfect! Thanks for the confirmation, closing the issue 🚀
@bart-acc commented on GitHub (Jul 18, 2025):
I did an updated and this problem is back for me. I downgraded to the version I had downloaded (v2025.3.2)
and it sends them in order again so it feels like some update after that version broke it again.and it is still broken for me, downgraded to 2025.3.1 and it also didn't work.The order seems stable so I reshuffled them in the UI such that they would end up being sent in the right order.Actually that working the first time I tried seems luck, I've just relabeled them and sort serverside but that's not something I can commit and there will be people who don't have control over what happens serverside.Maybe just running the installer of a previous version is not enough to downgrade the app fully? It says it's v2025.3.1 but looking at the comments above it obviously worked for some people.