fix(性能测试): 修改非200的2xx请求被判断为错误请求的缺陷

--bug=1032253 --user=宋天阳 【性能测试】报告-错误记录-所有记录-返回20X状态码显示为200
https://www.tapd.cn/55049933/s/1429223
This commit is contained in:
song-tianyang 2023-10-20 18:19:51 +08:00 committed by 刘瑞斌
parent d5ed574528
commit ec71c80e8a
2 changed files with 6 additions and 2 deletions

View File

@ -39,7 +39,7 @@
label="Response Code" label="Response Code"
min-width="180"> min-width="180">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span v-if="scope.row.code === '200' " style="color: #44b349">{{ scope.row.code }}</span> <span v-if="isSuccessRspCode(scope.row.code)" style="color: #44b349">{{ scope.row.code }}</span>
<span v-else style="color: #E6113C">{{ scope.row.code }}</span> <span v-else style="color: #E6113C">{{ scope.row.code }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -79,6 +79,9 @@ export default {
this.initTableData(); this.initTableData();
}, },
methods: { methods: {
isSuccessRspCode(code) {
return !(Number.isNaN(Number(code)) || 300 <= Number(code) || Number(code) < 200);
},
initTableData() { initTableData() {
if (this.errorSamples && this.errorSamples.sampleCount) { if (this.errorSamples && this.errorSamples.sampleCount) {
let allSampleCount = 0; let allSampleCount = 0;

View File

@ -46,7 +46,8 @@ export default {
for (let sampleName in this.samples.sampleCount) { for (let sampleName in this.samples.sampleCount) {
let sampleCountObj = this.samples.sampleCount[sampleName]; let sampleCountObj = this.samples.sampleCount[sampleName];
for (let code in sampleCountObj) { for (let code in sampleCountObj) {
if (code !== '200') {
if (Number.isNaN(Number(code)) || 300 <= Number(code) || Number(code) < 200) {
if (!this.errorSamples.sampleCount[sampleName]) { if (!this.errorSamples.sampleCount[sampleName]) {
this.errorSamples.sampleCount[sampleName] = {}; this.errorSamples.sampleCount[sampleName] = {};
this.errorSamples.samples[sampleName] = {}; this.errorSamples.samples[sampleName] = {};