fix: the createFilter func is incorrect (#132)
* fix: the createFilter func is incorrect * feat: format the JSON payload automatically
This commit is contained in:
parent
800d310db2
commit
17bdadc11d
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue