|
@@ -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, formatJson } from '../utils.js'
|
|
|
+import { definition2TreeList, getSizeUnit, formatJson, structureHasChanged } from '../utils.js'
|
|
|
import { parseJson } from '../parsing/parser.js'
|
|
|
import { nextTick } from 'vue'
|
|
|
function sendApiTestRequest(opened, requestConfig) {
|
|
@@ -49,8 +49,25 @@ function sendApiTestRequest(opened, requestConfig) {
|
|
|
} else {
|
|
|
opened.item.responseBody = formatJson(data)
|
|
|
let definition = parseJson(opened.item.responseBody, opened.item.responseBodyDefinition)
|
|
|
- opened.item.responseBodyDefinition = definition
|
|
|
- opened.responseBodyTree = definition2TreeList(definition)
|
|
|
+ if(structureHasChanged(opened.item.responseBodyDefinition, definition)){
|
|
|
+ bus.$emit(Message.NOTIFY, {
|
|
|
+ title: $i('message.tips'),
|
|
|
+ id: 'responseBodyStructure',
|
|
|
+ icon: 'info',
|
|
|
+ content: $i('api.structure.content', 'ResponseBody'),
|
|
|
+ buttons: [{
|
|
|
+ title: $i('api.structure.ok'),
|
|
|
+ onClick: () => {
|
|
|
+ opened.item.responseBodyDefinition = definition
|
|
|
+ opened.responseBodyTree = definition2TreeList(definition)
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ title: $i('message.cancel'),
|
|
|
+ onClick: () => {}
|
|
|
+ }]
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
opened.responseHeaders = res.headers
|
|
|
nextTick(() => bus.$emit(Message.SWITCH_TOOLBAR, 'response'))
|