Merge pull request #412 from postmanlabs/issue/382

Handle the case when request body is of type `string` and format `binary`
This commit is contained in:
Vishal Shingala
2021-10-05 11:39:11 +05:30
committed by GitHub
3 changed files with 38 additions and 7 deletions

View File

@@ -1873,13 +1873,25 @@ module.exports = {
}
}
bodyData = this.convertToPmBodyData(contentObj[bodyType], requestType, bodyType,
PARAMETER_SOURCE.REQUEST, options.indentCharacter, components, options, schemaCache);
if (
bodyType &&
!_.isEmpty(_.get(contentObj, [bodyType, 'schema'])) &&
contentObj[bodyType].schema.type === 'string' &&
contentObj[bodyType].schema.format === 'binary'
) {
updateOptions = {
mode: 'file'
};
}
else {
bodyData = this.convertToPmBodyData(contentObj[bodyType], requestType, bodyType,
PARAMETER_SOURCE.REQUEST, options.indentCharacter, components, options, schemaCache);
updateOptions = {
mode: rDataMode,
raw: JSON.stringify(bodyData, null, 4)
};
updateOptions = {
mode: rDataMode,
raw: JSON.stringify(bodyData, null, 4)
};
}
contentHeader = new sdk.Header({
key: 'Content-Type',