fix: the createFilter func is incorrect (#132)

* fix: the createFilter func is incorrect

* feat: format the JSON payload automatically
This commit is contained in:
Rick 2023-07-18 09:07:32 +08:00 committed by GitHub
parent 800d310db2
commit 17bdadc11d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -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"
/>
<el-table :data="testCaseWithSuite.data.request.form" style="width: 100%" v-if="bodyType === 4">
<el-table-column label="Key" width="180">