refactor(usage): 移除 RequestHeadersContent 中未使用的 diff props

移除 clientHeadersWithDiff 和 providerHeadersWithDiff 属性及相关计算逻辑
This commit is contained in:
fawney19
2026-02-26 02:36:37 +08:00
parent 61e0959a06
commit c0b80c923a
2 changed files with 2 additions and 42 deletions

View File

@@ -554,8 +554,6 @@
:current-header-data="currentHeaderData"
:current-expand-depth="currentExpandDepth"
:has-provider-headers="hasProviderHeaders"
:client-headers-with-diff="clientHeadersWithDiff"
:provider-headers-with-diff="providerHeadersWithDiff"
:header-stats="headerStats"
:is-dark="isDark"
/>
@@ -588,8 +586,6 @@
:current-header-data="currentResponseHeaderData"
:current-expand-depth="currentExpandDepth"
:has-provider-headers="hasProviderResponseHeaders"
:client-headers-with-diff="[]"
:provider-headers-with-diff="[]"
:header-stats="responseHeaderStats"
:is-dark="isDark"
:client-headers="detail.client_response_headers"
@@ -1506,42 +1502,6 @@ const headerStats = computed(() => {
return counts
})
const clientHeadersWithDiff = computed(() => {
if (!detail.value?.request_headers) return []
const headers = detail.value.request_headers
const result = []
for (const [key, value] of Object.entries(headers)) {
const diffEntry = mergedHeaderEntries.value.find(e => e.key === key)
result.push({
key,
value,
status: diffEntry?.status || 'unchanged'
})
}
return result
})
const providerHeadersWithDiff = computed(() => {
if (!detail.value?.provider_request_headers) return []
const headers = detail.value.provider_request_headers
const result = []
for (const [key, value] of Object.entries(headers)) {
const diffEntry = mergedHeaderEntries.value.find(e => e.key === key)
result.push({
key,
value,
status: diffEntry?.status || 'unchanged'
})
}
return result
})
// 添加 ESC 键监听
useEscapeKey(() => {
if (props.isOpen) {

View File

@@ -168,8 +168,6 @@ const props = withDefaults(defineProps<{
currentHeaderData: Record<string, unknown> | null
currentExpandDepth: number
hasProviderHeaders: boolean
clientHeadersWithDiff: Array<{ key: string; value: unknown; status: string }>
providerHeadersWithDiff: Array<{ key: string; value: unknown; status: string }>
headerStats: { added: number; modified: number; removed: number; unchanged: number }
isDark: boolean
// 泛化 props允许传入任意 header 对和标签,用于复用为响应头对比
@@ -179,6 +177,8 @@ const props = withDefaults(defineProps<{
providerLabel?: string
emptyMessage?: string
}>(), {
clientHeaders: undefined,
providerHeaders: undefined,
clientLabel: '客户端请求头',
providerLabel: '提供商请求头',
emptyMessage: '无请求头信息',