|
@@ -4,7 +4,7 @@ import request from '../request.js'
|
|
|
import bus from '../bus.js'
|
|
|
import $i from '../i18n.js'
|
|
|
import modal from '../../components/common/dialog/magic-modal.js'
|
|
|
-import { definition2TreeList, getSizeUnit } from '../utils.js'
|
|
|
+import { definition2TreeList, getSizeUnit, formatJson } from '../utils.js'
|
|
|
import { parseJson } from '../parsing/parser.js'
|
|
|
import { nextTick } from 'vue'
|
|
|
function sendApiTestRequest(opened, requestConfig) {
|
|
@@ -27,7 +27,8 @@ function sendApiTestRequest(opened, requestConfig) {
|
|
|
reader.readAsText(data)
|
|
|
reader.onload = function () {
|
|
|
try {
|
|
|
- resolve(JSON.parse(this.result))
|
|
|
+ JSON.parse(this.result)
|
|
|
+ resolve(this.result)
|
|
|
} catch (e) {
|
|
|
resolve(data)
|
|
|
}
|
|
@@ -46,7 +47,7 @@ function sendApiTestRequest(opened, requestConfig) {
|
|
|
opened.item.responseBodyDefinition = null
|
|
|
opened.responseBodyTree = null
|
|
|
} else {
|
|
|
- opened.item.responseBody = JSON.stringify(data)
|
|
|
+ opened.item.responseBody = formatJson(data)
|
|
|
let definition = parseJson(opened.item.responseBody, opened.item.responseBodyDefinition)
|
|
|
opened.item.responseBodyDefinition = definition
|
|
|
opened.responseBodyTree = definition2TreeList(definition)
|