Skip to content

Commit 1bee9fd

Browse files
committed
Merge branch 'release/4.2.0'
2 parents 85e4c05 + dee62f5 commit 1bee9fd

File tree

8 files changed

+160
-106
lines changed

8 files changed

+160
-106
lines changed

.github/travis-deploy-key.enc

-3.3 KB
Binary file not shown.

CHANGELOG.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
4.2.0:
2+
date: 2023-08-03
3+
new features:
4+
- GH-1329 Added support for `fileName` property in formdata request body
5+
- GH-1329 Retain string file content while parsing formdata and file bodies
6+
chores:
7+
- Updated dependencies
8+
19
4.1.7:
210
date: 2023-01-24
311
fixed bugs:

lib/collection/form-param.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ _.inherit((
2525
this.type = options.type;
2626
this.src = options.src;
2727
this.contentType = options.contentType;
28+
this.fileName = options.fileName;
2829
}), Property);
2930

3031
_.assign(FormParam.prototype, /** @lends FormParam.prototype */ {
@@ -54,8 +55,8 @@ _.assign(FormParam.prototype, /** @lends FormParam.prototype */ {
5455
toJSON () {
5556
var obj = PropertyBase.toJSON(this);
5657

57-
// remove value from file param because it is non-serializable ReadStream
58-
if (obj.type === 'file') {
58+
// remove value from file param if it's empty or non-string (can be non-serializable ReadStream)
59+
if (obj.type === 'file' && (typeof obj.value !== 'string' || !obj.value)) {
5960
_.unset(obj, 'value');
6061
}
6162

lib/collection/request-body.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ _.assign(RequestBody.prototype, /** @lends RequestBody.prototype */ {
214214
toJSON () {
215215
var obj = PropertyBase.toJSON(this);
216216

217-
// make sure that file content is removed because it is non-serializable ReadStream
218-
_.unset(obj, 'file.content');
217+
// remove value from file param if it's empty or non-string (can be non-serializable ReadStream)
218+
if (obj.file && obj.file.content && typeof obj.file.content !== 'string') {
219+
_.unset(obj, 'file.content');
220+
}
219221

220222
return obj;
221223
}

package-lock.json

Lines changed: 122 additions & 93 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)