From d24c9c43b264c2905583ca422ccaf51b0c95b007 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 8 Dec 2020 12:02:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=89=8D=E7=AB=AF=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/pom.xml | 9 +++- .../api/definition/components/ApiCaseList.vue | 30 +++++++------ .../api/definition/components/Run.vue | 44 ++++++++++--------- 3 files changed, 47 insertions(+), 36 deletions(-) diff --git a/backend/pom.xml b/backend/pom.xml index c123bf47ee..07439ad68f 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -263,13 +263,20 @@ spring-boot-starter-data-ldap - + io.swagger swagger-parser 1.0.51 + + + + + + + org.graalvm.sdk diff --git a/frontend/src/business/components/api/definition/components/ApiCaseList.vue b/frontend/src/business/components/api/definition/components/ApiCaseList.vue index ba3b68da9c..1ac808a75b 100644 --- a/frontend/src/business/components/api/definition/components/ApiCaseList.vue +++ b/frontend/src/business/components/api/definition/components/ApiCaseList.vue @@ -336,7 +336,7 @@ let bodyUploadFiles = []; row.bodyUploadIds = []; let request = row.request; - if (request.body) { + if (request.body && request.body.kvs) { request.body.kvs.forEach(param => { if (param.files) { param.files.forEach(item => { @@ -350,19 +350,21 @@ }); } }); - request.body.binary.forEach(param => { - if (param.files) { - param.files.forEach(item => { - if (item.file) { - let fileId = getUUID().substring(0, 8); - item.name = item.file.name; - item.id = fileId; - row.bodyUploadIds.push(fileId); - bodyUploadFiles.push(item.file); - } - }); - } - }); + if (request.body.binary) { + request.body.binary.forEach(param => { + if (param.files) { + param.files.forEach(item => { + if (item.file) { + let fileId = getUUID().substring(0, 8); + item.name = item.file.name; + item.id = fileId; + row.bodyUploadIds.push(fileId); + bodyUploadFiles.push(item.file); + } + }); + } + }); + } } return bodyUploadFiles; }, diff --git a/frontend/src/business/components/api/definition/components/Run.vue b/frontend/src/business/components/api/definition/components/Run.vue index 3d9e370d69..73c2c4c263 100644 --- a/frontend/src/business/components/api/definition/components/Run.vue +++ b/frontend/src/business/components/api/definition/components/Run.vue @@ -58,25 +58,10 @@ getBodyUploadFiles(obj) { let bodyUploadFiles = []; obj.bodyUploadIds = []; - this.runData.forEach(request => { - if (request.body) { - request.body.kvs.forEach(param => { - if (param.files) { - param.files.forEach(item => { - if (item.file) { - if (!item.id) { - let fileId = getUUID().substring(0, 12); - item.name = item.file.name; - item.id = fileId; - } - obj.bodyUploadIds.push(item.id); - bodyUploadFiles.push(item.file); - } - }); - } - }); - if (request.body.binary) { - request.body.binary.forEach(param => { + if (this.runData) { + this.runData.forEach(request => { + if (request.body) { + request.body.kvs.forEach(param => { if (param.files) { param.files.forEach(item => { if (item.file) { @@ -91,9 +76,26 @@ }); } }); + if (request.body.binary) { + request.body.binary.forEach(param => { + if (param.files) { + param.files.forEach(item => { + if (item.file) { + if (!item.id) { + let fileId = getUUID().substring(0, 12); + item.name = item.file.name; + item.id = fileId; + } + obj.bodyUploadIds.push(item.id); + bodyUploadFiles.push(item.file); + } + }); + } + }); + } } - } - }); + }); + } return bodyUploadFiles; }, run() {