Check for type and format in the original param instead of checking for value after processing

This commit is contained in:
Ankit Saini
2021-10-04 19:31:55 +05:30
parent 98f985612b
commit 2f7e214037
3 changed files with 13 additions and 4 deletions

View File

@@ -1701,6 +1701,7 @@ module.exports = {
var contentObj, // content is required
bodyData,
param,
originalParam,
paramArray = [],
updateOptions = {},
reqBody = new sdk.RequestBody(),
@@ -1832,8 +1833,14 @@ module.exports = {
}
}
// Set param type to 'file' for binary value
if (value === '<binary>') {
// Fetch the original param and if it is of type 'string' and format 'binary'
// then set the type of FormParam to 'file'
originalParam = _.get(contentObj[FORM_DATA], ['schema', 'properties', key]);
if (originalParam &&
originalParam.type === 'string' &&
originalParam.format === 'binary'
) {
param = new sdk.FormParam({
key: key,
value: '',