diff --git a/src/dashboard-front/src/views/online-debug/components/response-content.vue b/src/dashboard-front/src/views/online-debug/components/response-content.vue index bd55bdeae..ad04da1c6 100644 --- a/src/dashboard-front/src/views/online-debug/components/response-content.vue +++ b/src/dashboard-front/src/views/online-debug/components/response-content.vue @@ -18,6 +18,7 @@ @click="stopPropa"> +
@@ -38,78 +39,92 @@ @@ -134,9 +149,15 @@ const props = defineProps({ const emit = defineEmits(['response-fold']); +type TableDataItem = { + name: String; + value: String; +}; + const activeIndex = ref([]); const tabActive = ref('body'); const responseType = ref('JSON'); +const tableData = ref([]); const bodyTypeList = ref([ { value: 'JSON', @@ -207,10 +228,29 @@ const setEditorValue = () => { activeIndex.value = [1]; }; +const setTableData = () => { + const { headers } = data.value; + if (headers && JSON.stringify(headers) !== '{}') { + const list: TableDataItem[] = []; + Object.keys(headers).forEach((key: string) => { + list.push({ + name: key, + value: headers[key], + }); + }); + + tableData.value = list; + } else { + tableData.value = []; + } +}; + watch( () => tabActive.value, - () => { - setEditorValue(); + (v) => { + if (v !== 'headers') { + setEditorValue(); + } }, ); @@ -220,6 +260,7 @@ watch( data.value = v || {}; tabActive.value = 'body'; setEditorValue(); + setTableData(); }, );