Handling missing body properties

This commit is contained in:
abhijitkane
2019-07-22 17:45:18 +05:30
parent d344eed31c
commit 65f540bd27
4 changed files with 28 additions and 9 deletions

View File

@@ -280,7 +280,7 @@ module.exports = {
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#pathItemObject
getPathMethods = function(pathKeys) {
var methods = [];
pathKeys.forEach(function(element) {
pathKeys && pathKeys.forEach(function(element) {
if (METHODS.includes(element)) {
methods.push(element);
}
@@ -321,8 +321,6 @@ module.exports = {
currentNode.addChildren(currentPath[i], new Node({
name: currentPath[i],
requestCount: 0,
requests: [],
children: {},
type: 'item-group'
}));
}
@@ -1012,7 +1010,7 @@ module.exports = {
type: typeof value
};
params = this.convertParamsWithStyle(encoding[key], value);
params.forEach((element) => {
params && params.forEach((element) => {
if (typeof element.value === 'object') { element.value = JSON.stringify(element.value); }
// element.value = JSON.stringify(element.value);
delete element.description;
@@ -1387,7 +1385,7 @@ module.exports = {
item.request.body = pmBody.body;
item.request.addHeader(pmBody.contentHeader);
// extra form headers if encoding is present in request Body.
pmBody.formHeaders.forEach((element) => {
pmBody.formHeaders && pmBody.formHeaders.forEach((element) => {
item.request.addHeader(element);
});
}