mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
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:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user