访问日志中的响应Header和请求Header排序后显示

This commit is contained in:
刘祥超
2022-04-05 15:38:22 +08:00
parent f2841b7328
commit beff326001
2 changed files with 60 additions and 17 deletions

View File

@@ -4,4 +4,39 @@ Tea.context(function () {
this.switchTab = function (tab) {
this.tab = tab
}
this.requestHeaders = []
if (this.accessLog.header != null) {
for (let k in this.accessLog.header) {
let v = this.accessLog.header[k]
if (typeof (v) != "object") {
continue
}
this.requestHeaders.push({
name: k,
values: v.values
})
}
}
this.requestHeaders.sort(function (v1, v2) {
return (v1.name < v2.name) ? -1 : 1
})
this.responseHeaders = []
if (this.accessLog.sentHeader != null) {
for (let k in this.accessLog.sentHeader) {
let v = this.accessLog.sentHeader[k]
if (typeof (v) != "object") {
continue
}
this.responseHeaders.push({
name: k,
values: v.values
})
}
}
this.responseHeaders.sort(function (v1, v2) {
return (v1.name < v2.name) ? -1 : 1
})
})