mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
added some more util function tests
This commit is contained in:
12
lib/util.js
12
lib/util.js
@@ -463,7 +463,7 @@ module.exports = {
|
||||
responseBody = this.convertToPmBodyData(contentObj[APP_XML]);
|
||||
}
|
||||
else if (contentObj[APP_JS]) {
|
||||
responseBody = this.convertToPmBodyData(contentObj[APP_XML]);
|
||||
responseBody = this.convertToPmBodyData(contentObj[APP_JS]);
|
||||
}
|
||||
else if (contentObj[TEXT_PLAIN]) {
|
||||
responseBody = this.convertToPmBodyData(contentObj[TEXT_PLAIN]);
|
||||
@@ -510,12 +510,16 @@ module.exports = {
|
||||
var example,
|
||||
exampleKey;
|
||||
|
||||
if (exampleObj) {
|
||||
if (!exampleObj) {
|
||||
return {};
|
||||
}
|
||||
|
||||
exampleKey = Object.keys(exampleObj)[0];
|
||||
example = exampleObj[exampleKey];
|
||||
// return example value if present else example is returned
|
||||
if (example.value) {
|
||||
example = example.value;
|
||||
}
|
||||
|
||||
return example;
|
||||
},
|
||||
@@ -539,6 +543,10 @@ module.exports = {
|
||||
}
|
||||
else if (bodyObj.hasOwnProperty('example')) {
|
||||
bodyData = bodyObj.example;
|
||||
// return example value if present else example is returned
|
||||
if (bodyData.value) {
|
||||
bodyData = bodyData.value;
|
||||
}
|
||||
}
|
||||
return bodyData;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user