Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 126184e

Browse files
committedMay 3, 2022
Adjusted setting of boundaries in loop
Fixed linting fixed looping
1 parent 37b042f commit 126184e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎codegens/http/lib/util.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function convertPropListToStringUrlEncoded (propertyList, joinUsing, includeDisa
150150
*/
151151
function getHeaders (request) {
152152
let contentTypeIndex = _.findIndex(request.headers.members, { key: 'Content-Type' }),
153-
formDataHeader = `multipart/form-data; boundary=--${FORM_DATA_BOUNDARY}`,
153+
formDataHeader = `multipart/form-data; boundary=${FORM_DATA_BOUNDARY}`,
154154
headers = '';
155155

156156
if (contentTypeIndex >= 0) {
@@ -213,9 +213,9 @@ function getBody (request, trimRequestBody) {
213213
return trimRequestBody ? requestBody.trim() : requestBody;
214214

215215
case FORM_DATA:
216-
requestBody += `--${FORM_DATA_BOUNDARY}\n`;
217216
/* istanbul ignore else */
218217
if (!_.isEmpty(request.body[request.body.mode])) {
218+
requestBody += `--${FORM_DATA_BOUNDARY}\n`;
219219
let properties = getMembersOfPropertyList(request.body[request.body.mode]);
220220
_.forEach(properties, function (property) {
221221
/* istanbul ignore else */
@@ -242,8 +242,8 @@ function getBody (request, trimRequestBody) {
242242
}
243243
requestBody += '(data)\n';
244244
}
245-
requestBody += `--${FORM_DATA_BOUNDARY}--\n`;
246245
});
246+
requestBody += `--${FORM_DATA_BOUNDARY}--`;
247247
}
248248
return trimRequestBody ? requestBody.trim() : requestBody;
249249

‎codegens/http/test/resources/expected-http-messages.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"GET /headers HTTP/1.1\nHost: postman-echo.com\nmy-sample-header: Lorem ipsum dolor sit amet\nTEST: @#$%^&*()\nmore: ,./';[]}{\":?><|\\\\",
55
"GET /headers HTTP/1.1\nHost: postman-echo.com\nmy-sample-header: Lorem ipsum dolor sit amet\nnot-disabled-header: ENABLED",
66
"GET /get?test=123&anotherone=232 HTTP/1.1\nHost: postman-echo.com",
7-
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Length: 586\nContent-Type: multipart/form-data; boundary=--WebKitFormBoundary7MA4YWxkTrZu0gW\n\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"pl\"\n\n'a'\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"qu\"\n\n\"b\"\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"hdjkljh\"\n\nc\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"sa\"\n\nd\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"Special\"\n\n!@#$%&*()^_+=`~ \n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"more\"\n\n,./';[]}{\":?><|\\\\\n----WebKitFormBoundary7MA4YWxkTrZu0gW--\n",
7+
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Length: 586\nContent-Type: multipart/form-data; boundary=--WebKitFormBoundary7MA4YWxkTrZu0gW\n\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"pl\"\n\n'a'\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"qu\"\n\n\"b\"\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"hdjkljh\"\n\nc\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"sa\"\n\nd\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"Special\"\n\n!@#$%&*()^_+=`~ \n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"more\"\n\n,./';[]}{\":?><|\\\\\n----WebKitFormBoundary7MA4YWxkTrZu0gW--",
88
"POST /post?a=!@$^*()_-`%26&b=,./';[]}{\":/?><|| HTTP/1.1\nHost: postman-echo.com",
99
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 284\n\nDuis posuere augue vel cursus pharetra. In luctus a ex nec pretium. Praesent neque quam, tincidunt nec leo eget, rutrum vehicula magna.\nMaecenas consequat elementum elit, id semper sem tristique et. Integer pulvinar enim quis consectetur interdum volutpat.!@#$%^&*()+POL:},'';,[;[;\n\n\n",
1010
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 147\n\n1='a'&2=%22b%22&'3'=c&%224%22=d&Special=!%40%23%24%25%26*()%5E_%3D%60~%20%20%20%20&more=%2C.%2F'%3B%5B%5D%7D%7B%22%3A%3F%3E%3C%7C%5C%5C%20%20%20%20",
@@ -25,7 +25,7 @@
2525
"VIEW /request HTTP/1.1\nHost: mockbin.org\nContent-Type: text/plain\nContent-Length: 256\n\nDuis posuere augue vel cursus pharetra. In luctus a ex nec pretium. Praesent neque quam, tincidunt nec leo eget, rutrum vehicula magna.\nMaecenas consequat elementum elit, id semper sem tristique et. Integer pulvinar enim quis consectetur interdum volutpat.",
2626
"PURGE / HTTP/1.1\nHost: 9c76407d-5b8d-4b22-99fb-8c47a85d9848.mock.pstmn.io",
2727
"COPY / HTTP/1.1\nHost: 9c76407d-5b8d-4b22-99fb-8c47a85d9848.mock.pstmn.io",
28-
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Type: multipart/form-data; boundary=--WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Length: 174\n\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"file\"; filename=\"file.txt\"\nContent-Type: text/plain\n\n(data)\n----WebKitFormBoundary7MA4YWxkTrZu0gW--\n",
28+
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Type: multipart/form-data; boundary=--WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Length: 174\n\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"file\"; filename=\"file.txt\"\nContent-Type: text/plain\n\n(data)\n----WebKitFormBoundary7MA4YWxkTrZu0gW--",
2929
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Type: text/plain\nContent-Length: 22\n\n\"<file contents here>\"",
3030
"GET / HTTP/1.1\nHost: localhost:5050",
3131
"GET /knockknock HTTP/1.1\nHost: localhost:5050"

0 commit comments

Comments
 (0)
Please sign in to comment.