Skip to content

Add extra hyphens #652

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Dec 16, 2022
Merged

Add extra hyphens #652

merged 1 commit into from
Dec 16, 2022

Conversation

LuisTejedaS
Copy link
Contributor

@LuisTejedaS LuisTejedaS commented Nov 9, 2022

From the issue:

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.

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

Solution
Add the double hyphen at the beginning of the boundaries mark and the double hyphen at the end of the last boundary and

fixes: postmanlabs/postman-app-support#11084

Add extra hyphens
@LuisTejedaS LuisTejedaS requested a review from erfemega November 9, 2022 23:03
@LuisTejedaS LuisTejedaS self-assigned this Nov 9, 2022
@LuisTejedaS LuisTejedaS marked this pull request as ready for review November 9, 2022 23:18
@erfemega
Copy link
Contributor

Looks good!

@LuisTejedaS LuisTejedaS requested a review from umeshp7 November 10, 2022 00:11
@LuisTejedaS
Copy link
Contributor Author

@umeshp7 could we merge this already? or there is something else to do?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In the HTTP code snippet generator multipart/form-data boundaries are wrong
3 participants