diff --git a/console/atest-ui/src/views/TestCase.vue b/console/atest-ui/src/views/TestCase.vue index 1a1f0bf..7dc697c 100644 --- a/console/atest-ui/src/views/TestCase.vue +++ b/console/atest-ui/src/views/TestCase.vue @@ -76,7 +76,7 @@ const queryBodyFields = (queryString: string, cb: any) => { } as Pair) }) - const results = queryString ? pairs.filter(createFilter(queryString)) : pairs + const results = queryString ? pairs.filter(CreateFilter(queryString)) : pairs // call callback function to return suggestions cb(results) } @@ -311,6 +311,18 @@ function bodyTypeChange(e: number) { } } +function jsonForamt() { + if (bodyType.value !== 5) { + return + } + + try { + testCaseWithSuite.value.data.request.body = JSON.stringify(JSON.parse(testCaseWithSuite.value.data.request.body), null, 4) + } catch (e) { + console.log(e) + } +} + function insertOrUpdateIntoMap(pair: Pair, pairs: Pair[]) { const index = pairs.findIndex((e) => e.key === pair.key) if (index === -1) { @@ -459,6 +471,7 @@ function flattenObject(obj: any): any { :autosize="{ minRows: 4, maxRows: 8 }" type="textarea" placeholder="Please input" + @change="jsonForamt" />