You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the tracker for existing similar issues and I know that duplicates will be closed
Describe the Issue
In a very short way. By the specification for the Content-Type: multipart/form-data we should specify boundary marker. Once this marker is used in the body, it should contain two additional dashes in the beginning of the marker line.
We tried to generate the HTTP Code snippet and we can see that the dashes are not automatically added to the body fields and the last marker should be finished with two dashes, which is also not the part of the snippet code.
Steps To Reproduce
Open a new tab
Paste some address and select POST method
Select "form-data"
Add one arbitrary field, e.g. key = foo, value = bar
Open code snippet generator
Select "HTTP" type
Expected result:
POST / HTTP/1.1
Host: www.google.com
Content-Length: 129
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="foo"
bar
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Actual result:
POST / HTTP/1.1
Host: www.google.com
Content-Length: 124
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="foo"
bar
----WebKitFormBoundary7MA4YWxkTrZu0gW
To prove that it's expected result:
select the "javascript - fetch" in the type of the Code Snippet generator
open the google.com in the browser
open chrome dev console
paste the fetch request
press "enter" to send the request
Open networks tab, find appropriate request in the list of network requests
Pay attention to the number of dashes in the content-type (4 of them):
- Open "payload" tab of this request
- Click on "View source". Pay attention to the number of dashes in the first and last lines:
------WebKitFormBoundaryaS5GsqgYgDVOUdlC
Content-Disposition: form-data; name="foo"
bar
------WebKitFormBoundaryaS5GsqgYgDVOUdlC--
You can see that it contains 6 dashes before boundary marker and two dashes after the last boundary marker.
Screenshots or Videos
No response
Operating System
macOs
Postman Version
9.24.2
Postman Platform
Postman App
Additional Context?
No response
The text was updated successfully, but these errors were encountered:
ValeriyMaslenikov
changed the title
In the HTTP code snippet generator multipart/form-data boundaries is wrong
In the HTTP code snippet generator multipart/form-data boundaries are wrong
Jul 14, 2022
Is there an existing issue for this?
Describe the Issue
In a very short way. By the specification for the
Content-Type: multipart/form-data
we should specify boundary marker. Once this marker is used in the body, it should contain two additional dashes in the beginning of the marker line.We tried to generate the HTTP Code snippet and we can see that the dashes are not automatically added to the body fields and the last marker should be finished with two dashes, which is also not the part of the snippet code.
Steps To Reproduce
Expected result:
Actual result:
To prove that it's expected result:

- Open "payload" tab of this request - Click on "View source". Pay attention to the number of dashes in the first and last lines:You can see that it contains 6 dashes before boundary marker and two dashes after the last boundary marker.
Screenshots or Videos
No response
Operating System
macOs
Postman Version
9.24.2
Postman Platform
Postman App
Additional Context?
No response
The text was updated successfully, but these errors were encountered: