[GH-ISSUE #1833] The fields of a request with body type multipart/form-data do not follow the order configured in the request #582

Closed
opened 2026-03-16 16:07:28 +03:00 by kerem · 13 comments
Owner

Originally created by @sawa-ko on GitHub (Sep 20, 2021).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1833

Describe the bug
I have noticed that when sending a request, the order of the fields set in the request body configuration is not followed, and this can cause failures in applications where a specific order must be followed in the body fields.

I noticed that because with hoppscotch when I try to send this request to my graphql server with graphql-upload, I get this error, and that error is because the file fields are not followed by the map field, so the error appears.

And I don't think it is graphql-upload error because I make exactly the same request with postman and it works correctly.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'rest section'
  2. Create a request with body of type multipart/form-data
  3. Click on 'Send'
  4. See error

Expected behavior
That the body fields have the same order as configured in the request when sending the request to the server.

Screenshots

https://user-images.githubusercontent.com/56084970/133948340-8b6f9fb4-d80b-4d5c-b049-8d582d51126c.mp4

Desktop (please complete the following information):

  • OS: Windows
  • Browser: edge
  • Version 93.0.961.52

Additional context
I don't know if the same is true for other types of request body.

Originally created by @sawa-ko on GitHub (Sep 20, 2021). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1833 **Describe the bug** I have noticed that when sending a request, the order of the fields set in the request body configuration is not followed, and this can cause failures in applications where a specific order must be followed in the body fields. I noticed that because with hoppscotch when I try to send this request to my graphql server with graphql-upload, I get this error, and that error is because the file fields are not followed by the map field, so the error appears. And I don't think it is graphql-upload error because I make exactly the same request with postman and it works correctly. **To Reproduce** Steps to reproduce the behavior: 1. Go to 'rest section' 2. Create a request with body of type multipart/form-data 3. Click on 'Send' 4. See error **Expected behavior** That the body fields have the same order as configured in the request when sending the request to the server. **Screenshots** https://user-images.githubusercontent.com/56084970/133948340-8b6f9fb4-d80b-4d5c-b049-8d582d51126c.mp4 **Desktop (please complete the following information):** - OS: Windows - Browser: edge - Version 93.0.961.52 **Additional context** I don't know if the same is true for other types of request body.
kerem 2026-03-16 16:07:28 +03:00
Author
Owner

@liyasthomas commented on GitHub (Sep 20, 2021):

Thanks for reporting this issue. We're working on a fix. Will update here once it lands on production.

<!-- gh-comment-id:922604302 --> @liyasthomas commented on GitHub (Sep 20, 2021): Thanks for reporting this issue. We're working on a fix. Will update here once it lands on production.
Author
Owner

@mandaputtra commented on GitHub (Oct 1, 2021):

Hi, @kaname-png could you recall the wrong order? I test the step and I got same order as the request. Or maybe I was wrong on testing it?

Screenshot from 2021-10-01 09-09-48

<!-- gh-comment-id:931839574 --> @mandaputtra commented on GitHub (Oct 1, 2021): Hi, @kaname-png could you recall the wrong order? I test the step and I got same order as the request. Or maybe I was wrong on testing it? ![Screenshot from 2021-10-01 09-09-48](https://user-images.githubusercontent.com/23342943/135554918-02ac745f-b4af-4063-ac36-941319647fb5.png)
Author
Owner

@sawa-ko commented on GitHub (Oct 1, 2021):

As you can see I execute the same request in both applications and I get that error in hoppscotch and in postman I don't get the error I mention.

For what it's worth, I'm using nestjs with graphql and the graphql-upload plugin.

<!-- gh-comment-id:931868721 --> @sawa-ko commented on GitHub (Oct 1, 2021): As you can see I execute the same request in both applications and I get that error in hoppscotch and in postman I don't get the error I mention. For what it's worth, I'm using nestjs with graphql and the graphql-upload plugin.
Author
Owner

@mandaputtra commented on GitHub (Oct 1, 2021):

If you could make some simple repo nestjs + graphql + graphql-upload demonstrating this error. I could work on this issue. I'm just not fond with graphql.

<!-- gh-comment-id:931874073 --> @mandaputtra commented on GitHub (Oct 1, 2021): If you could make some simple repo nestjs + graphql + graphql-upload demonstrating this error. I could work on this issue. I'm just not fond with graphql.
Author
Owner

@rishabhkalra96 commented on GitHub (Oct 9, 2021):

@mandaputtra do we have any update on this ? is it worth looking ?

<!-- gh-comment-id:939298599 --> @rishabhkalra96 commented on GitHub (Oct 9, 2021): @mandaputtra do we have any update on this ? is it worth looking ?
Author
Owner

@mandaputtra commented on GitHub (Oct 9, 2021):

ifyou can reproduce go ahead i never work with graphql

<!-- gh-comment-id:939303465 --> @mandaputtra commented on GitHub (Oct 9, 2021): ifyou can reproduce go ahead i never work with graphql
Author
Owner

@rishabhkalra96 commented on GitHub (Oct 9, 2021):

sure, will try to see if i can reproduce it. Never worked on graphql myself. Is there a way we can have access to any existing graphql api which could produce same issue ? Maybe @kaname-png can help with this ?

<!-- gh-comment-id:939313493 --> @rishabhkalra96 commented on GitHub (Oct 9, 2021): sure, will try to see if i can reproduce it. Never worked on graphql myself. Is there a way we can have access to any existing graphql api which could produce same issue ? Maybe @kaname-png can help with this ?
Author
Owner

@kyteinsky commented on GitHub (Jan 16, 2022):

It is an issue similar to this one, that was posted for postman originally. So essentially 0 is alphabetically ordered and placed before map in the request, which causes the issue here.

It can be a simple fix to work on, just ensuring all file fields come after the map parameter.

Do I have your green flag @liyasthomas to work on this?

<!-- gh-comment-id:1013859749 --> @kyteinsky commented on GitHub (Jan 16, 2022): It is an issue similar to [this one](https://stackoverflow.com/questions/49771811/postman-ordering-of-fields-in-form-data-request/53756457), that was posted for postman originally. So essentially `0` is alphabetically ordered and placed before `map` in the request, which causes the issue here. It can be a simple fix to work on, just ensuring all file fields come after the `map parameter`. Do I have your green flag @liyasthomas to work on this?
Author
Owner

@liyasthomas commented on GitHub (Jan 16, 2022):

Hi @kyteinsky, you can give this a try. Do let us know if you've any doubts on the source code.

<!-- gh-comment-id:1013859947 --> @liyasthomas commented on GitHub (Jan 16, 2022): Hi @kyteinsky, you can give this a try. Do let us know if you've any doubts on the source code.
Author
Owner

@kyteinsky commented on GitHub (Jan 16, 2022):

Sure thing. Thanks!

<!-- gh-comment-id:1013860004 --> @kyteinsky commented on GitHub (Jan 16, 2022): Sure thing. Thanks!
Author
Owner

@AndrewBastin commented on GitHub (Jan 21, 2022):

@kaname-png does the implementation in the PR #2067 fix the issues for you ?

You can test the implementation using this Deploy Preview URL: https://deploy-preview-2067--hoppscotch.netlify.app/

<!-- gh-comment-id:1018461167 --> @AndrewBastin commented on GitHub (Jan 21, 2022): @kaname-png does the implementation in the PR #2067 fix the issues for you ? You can test the implementation using this Deploy Preview URL: https://deploy-preview-2067--hoppscotch.netlify.app/
Author
Owner

@sawa-ko commented on GitHub (Jan 22, 2022):

@AndrewBastin I can confirm that the problem has indeed been solved.
And sorry for not giving a playground, I didn't see the notification until now.

<!-- gh-comment-id:1019315536 --> @sawa-ko commented on GitHub (Jan 22, 2022): @AndrewBastin I can confirm that the problem has indeed been solved. And sorry for not giving a playground, I didn't see the notification until now.
Author
Owner

@AndrewBastin commented on GitHub (Jan 22, 2022):

@kaname-png No worries! Thank you for confirming the fix and your continued contribution to the project! ♥️

<!-- gh-comment-id:1019316474 --> @AndrewBastin commented on GitHub (Jan 22, 2022): @kaname-png No worries! Thank you for confirming the fix and your continued contribution to the project! ♥️
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#582
No description provided.