Skip to content

Commit

Permalink
Merge branch 'release/4.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
codenirvana committed Aug 3, 2023
2 parents 85e4c05 + dee62f5 commit 1bee9fd
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 106 deletions.
Binary file removed .github/travis-deploy-key.enc
Binary file not shown.
8 changes: 8 additions & 0 deletions CHANGELOG.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
4.2.0:
date: 2023-08-03
new features:
- GH-1329 Added support for `fileName` property in formdata request body
- GH-1329 Retain string file content while parsing formdata and file bodies
chores:
- Updated dependencies

4.1.7:
date: 2023-01-24
fixed bugs:
Expand Down
5 changes: 3 additions & 2 deletions lib/collection/form-param.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ _.inherit((
this.type = options.type;
this.src = options.src;
this.contentType = options.contentType;
this.fileName = options.fileName;
}), Property);

_.assign(FormParam.prototype, /** @lends FormParam.prototype */ {
Expand Down Expand Up @@ -54,8 +55,8 @@ _.assign(FormParam.prototype, /** @lends FormParam.prototype */ {
toJSON () {
var obj = PropertyBase.toJSON(this);

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

Expand Down
6 changes: 4 additions & 2 deletions lib/collection/request-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ _.assign(RequestBody.prototype, /** @lends RequestBody.prototype */ {
toJSON () {
var obj = PropertyBase.toJSON(this);

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

return obj;
}
Expand Down
215 changes: 122 additions & 93 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1bee9fd

Please sign in to comment.