fix(接口测试): TCP接口,版本对比,版本和内容显示反了

--bug=1011749
--user=郭雨琦
TCP接口,版本对比,版本和内容显示反了
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001011749
This commit is contained in:
guoyuqi 2022-03-29 11:49:22 +08:00 committed by 刘瑞斌
parent 91967313e4
commit a9cdf4a2bc
4 changed files with 92 additions and 94 deletions

View File

@ -60,7 +60,7 @@
:new-show-follow="newShowFollow"
:module-options="moduleOptions"
:request="request"
:old-request="oldRequest"
:old-request="newRequest"
></dubbo-api-version-diff>
</el-dialog>
@ -162,8 +162,8 @@ export default {
newShowFollow: false,
versionData: [],
newData: {},
oldRequest: {},
oldResponse: {},
newRequest: {},
newResponse: {},
createNewVersionVisible: false,
};
},
@ -246,7 +246,7 @@ export default {
this.dealWithTag(res.data);
this.setRequest(res.data)
if (!this.setRequest(res.data)) {
this.oldRequest = createComponent("DubboSampler");
this.newRequest = createComponent("DubboSampler");
this.dialogVisible = true;
}
this.formatApi(res.data)
@ -258,12 +258,12 @@ export default {
setRequest(api) {
if (api.request !== undefined) {
if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
this.oldRequest = api.request;
this.newRequest = api.request;
} else {
this.oldRequest = JSON.parse(api.request);
this.newRequest = JSON.parse(api.request);
}
if (!this.oldRequest.headers) {
this.oldRequest.headers = [];
if (!this.newRequest.headers) {
this.newRequest.headers = [];
}
this.dialogVisible = true;
return true;
@ -285,23 +285,23 @@ export default {
formatApi(api) {
if (api.response != null && api.response !== 'null' && api.response !== undefined) {
if (Object.prototype.toString.call(api.response).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
this.oldResponse = api.response;
this.newResponse = api.response;
} else {
this.oldResponse = JSON.parse(api.response);
this.newResponse = JSON.parse(api.response);
}
} else {
this.oldResponse = {headers: [], body: new Body(), statusCode: [], type: "HTTP"};
this.newResponse = {headers: [], body: new Body(), statusCode: [], type: "HTTP"};
}
if (!this.oldRequest.hashTree) {
this.oldRequest.hashTree = [];
if (!this.newRequest.hashTree) {
this.newRequest.hashTree = [];
}
if (this.oldRequest.body && !this.oldRequest.body.binary) {
this.oldRequest.body.binary = [];
if (this.newRequest.body && !this.newRequest.body.binary) {
this.newRequest.body.binary = [];
}
//
if (this.oldResponse.body) {
if (this.newResponse.body) {
let body = new Body();
Object.assign(body, this.oldResponse.body);
Object.assign(body, this.newResponse.body);
if (!body.binary) {
body.binary = [];
}
@ -311,11 +311,11 @@ export default {
if (!body.binary) {
body.binary = [];
}
this.oldResponse.body = body;
this.newResponse.body = body;
}
this.oldRequest.clazzName = TYPE_TO_C.get(this.oldRequest.type);
this.newRequest.clazzName = TYPE_TO_C.get(this.newRequest.type);
this.sort(this.oldRequest.hashTree);
this.sort(this.newRequest.hashTree);
},
sort(stepArray) {
if (stepArray) {

View File

@ -151,10 +151,10 @@
:rule="rule"
:maintainer-options="maintainerOptions"
:module-options="moduleOptions"
:request="request"
:old-request="oldRequest"
:response="response"
:old-response="oldResponse"
:request="newRequest"
:old-request="request"
:response="newResponse"
:old-response="response"
></http-api-version-diff>
</el-dialog>
@ -258,8 +258,8 @@ export default {
newMockBaseUrl: "",
count: 0,
versionData: [],
oldRequest: Sampler,
oldResponse: {},
newRequest:Sampler,
newResponse:{},
createNewVersionVisible: false,
};
},
@ -572,7 +572,7 @@ export default {
this.dealWithTag(res.data);
this.setRequest(res.data);
if (!this.setRequest(res.data)) {
this.oldRequest = createComponent("HTTPSamplerProxy");
this.newRequest = createComponent("HTTPSamplerProxy");
this.dialogVisible = true;
}
this.formatApi(res.data);
@ -583,12 +583,12 @@ export default {
setRequest(api) {
if (api.request !== undefined) {
if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
this.oldRequest = api.request;
this.newRequest = api.request;
} else {
this.oldRequest = JSON.parse(api.request);
this.newRequest = JSON.parse(api.request);
}
if (!this.oldRequest.headers) {
this.oldRequest.headers = [];
if (!this.newRequest.headers) {
this.newRequest.headers = [];
}
this.dialogVisible = true;
return true;
@ -610,23 +610,23 @@ export default {
formatApi(api) {
if (api.response != null && api.response !== 'null' && api.response !== undefined) {
if (Object.prototype.toString.call(api.response).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
this.oldResponse = api.response;
this.newResponse = api.response;
} else {
this.oldResponse = JSON.parse(api.response);
this.newResponse = JSON.parse(api.response);
}
} else {
this.oldResponse = {headers: [], body: new Body(), statusCode: [], type: "HTTP"};
this.newResponse = {headers: [], body: new Body(), statusCode: [], type: "HTTP"};
}
if (!this.oldRequest.hashTree) {
this.oldRequest.hashTree = [];
if (!this.newRequest.hashTree) {
this.newRequest.hashTree = [];
}
if (this.oldRequest.body && !this.oldRequest.body.binary) {
this.oldRequest.body.binary = [];
if (this.newRequest.body && !this.newRequest.body.binary) {
this.newRequest.body.binary = [];
}
//
if (this.oldResponse.body) {
if (this.newResponse.body) {
let body = new Body();
Object.assign(body, this.oldResponse.body);
Object.assign(body, this.newResponse.body);
if (!body.binary) {
body.binary = [];
}
@ -636,11 +636,11 @@ export default {
if (!body.binary) {
body.binary = [];
}
this.oldResponse.body = body;
this.newResponse.body = body;
}
this.oldRequest.clazzName = TYPE_TO_C.get(this.oldRequest.type);
this.newRequest.clazzName = TYPE_TO_C.get(this.newRequest.type);
this.sort(this.oldRequest.hashTree);
this.sort(this.newRequest.hashTree);
},
sort(stepArray) {
if (stepArray) {
@ -662,8 +662,6 @@ export default {
},
cancelCreateNewVersion() {
this.createNewVersionVisible = false;
// this.httpForm.versionId = row.id;
// this.httpForm.versionName = row.name;
this.getVersionHistory();
},
checkout(row) {

View File

@ -60,8 +60,8 @@
:new-data="newData"
:new-show-follow="newShowFollow"
:module-options="moduleOptions"
:request="request"
:old-request="oldRequest"
:request="newRequest"
:old-request="request"
></s-q-l-api-version-diff>
</el-dialog>
@ -150,8 +150,8 @@ export default {
newShowFollow: false,
versionData: [],
newData: {},
oldRequest: {},
oldResponse: {},
newRequest: {},
newResponse: {},
createNewVersionVisible: false,
};
},
@ -249,9 +249,9 @@ export default {
this.dealWithTag(res.data);
this.setRequest(res.data)
if (!this.setRequest(res.data)) {
this.oldRequest = createComponent("JDBCSampler");
if (!this.oldRequest.variables) {
this.oldRequest.variables = [];
this.newRequest = createComponent("JDBCSampler");
if (!this.newRequest.variables) {
this.newRequest.variables = [];
}
this.dialogVisible = true
}
@ -264,12 +264,12 @@ export default {
setRequest(api) {
if (api.request !== undefined) {
if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
this.oldRequest = api.request;
this.newRequest = api.request;
} else {
this.oldRequest = JSON.parse(api.request);
this.newRequest = JSON.parse(api.request);
}
if (!this.oldRequest.headers) {
this.oldRequest.headers = [];
if (!this.newRequest.headers) {
this.newRequest.headers = [];
}
this.dialogVisible = true
return true;
@ -291,23 +291,23 @@ export default {
formatApi(api) {
if (api.response != null && api.response !== 'null' && api.response !== undefined) {
if (Object.prototype.toString.call(api.response).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
this.oldResponse = api.response;
this.newResponse = api.response;
} else {
this.oldResponse = JSON.parse(api.response);
this.newResponse = JSON.parse(api.response);
}
} else {
this.oldResponse = {headers: [], body: new Body(), statusCode: [], type: "HTTP"};
this.newResponse = {headers: [], body: new Body(), statusCode: [], type: "HTTP"};
}
if (!this.oldRequest.hashTree) {
this.oldRequest.hashTree = [];
if (!this.newRequest.hashTree) {
this.newRequest.hashTree = [];
}
if (this.oldRequest.body && !this.oldRequest.body.binary) {
this.oldRequest.body.binary = [];
if (this.newRequest.body && !this.newRequest.body.binary) {
this.newRequest.body.binary = [];
}
//
if (this.oldResponse.body) {
if (this.newResponse.body) {
let body = new Body();
Object.assign(body, this.oldResponse.body);
Object.assign(body, this.newResponse.body);
if (!body.binary) {
body.binary = [];
}
@ -317,10 +317,10 @@ export default {
if (!body.binary) {
body.binary = [];
}
this.oldResponse.body = body;
this.newResponse.body = body;
}
this.oldRequest.clazzName = TYPE_TO_C.get(this.oldRequest.type);
this.sort(this.oldRequest.hashTree);
this.newRequest.clazzName = TYPE_TO_C.get(this.newRequest.type);
this.sort(this.newRequest.hashTree);
},
sort(stepArray) {
if (stepArray) {

View File

@ -89,11 +89,11 @@
:new-data="newData"
:new-show-follow="newShowFollow"
:module-options="moduleOptions"
:request="request"
:old-request="oldRequest"
:request="newRequest"
:old-request="request"
:mock-info="mockInfo"
:api-protocol="apiProtocol"
:old-api-protocol="oldApiProtocol"
:old-api-protocol="newApiProtocol"
:show-xpack-compnent="showXpackCompnent"
:method-types="methodTypes"
></t-c-p-api-version-diff>
@ -176,9 +176,9 @@ export default {
dialogVisible: false,
newShowFollow: false,
newData: {},
oldRequest: {},
oldResponse: {},
oldApiProtocol: "TCP",
newRequest: {},
newResponse: {},
newApiProtocol: "TCP",
createNewVersionVisible: false,
};
},
@ -369,14 +369,14 @@ export default {
if (this.newData.method !== 'TCP' && this.newData.method !== 'ESB') {
this.newData.method = this.newData.protocol;
}
this.oldApiProtocol = this.basisData.method;
if (this.oldApiProtocol == null || this.oldApiProtocol === "") {
this.oldApiProtocol = "TCP";
this.newApiProtocol = this.basisData.method;
if (this.newApiProtocol == null || this.newApiProtocol === "") {
this.newApiProtocol = "TCP";
}
this.dealWithTag(res.data);
this.setRequest(res.data)
if (!this.setRequest(res.data)) {
this.oldRequest = createComponent("TCPSampler");
this.newRequest = createComponent("TCPSampler");
this.dialogVisible = true;
}
this.formatApi(res.data)
@ -388,12 +388,12 @@ export default {
setRequest(api) {
if (api.request !== undefined) {
if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
this.oldRequest = api.request;
this.newRequest = api.request;
} else {
this.oldRequest = JSON.parse(api.request);
this.newRequest = JSON.parse(api.request);
}
if (!this.oldRequest.headers) {
this.oldRequest.headers = [];
if (!this.newRequest.headers) {
this.newRequest.headers = [];
}
this.dialogVisible = true;
return true;
@ -415,23 +415,23 @@ export default {
formatApi(api) {
if (api.response != null && api.response !== 'null' && api.response !== undefined) {
if (Object.prototype.toString.call(api.response).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
this.oldResponse = api.response;
this.newResponse = api.response;
} else {
this.oldResponse = JSON.parse(api.response);
this.newResponse = JSON.parse(api.response);
}
} else {
this.oldResponse = {headers: [], body: new Body(), statusCode: [], type: "HTTP"};
this.newResponse = {headers: [], body: new Body(), statusCode: [], type: "HTTP"};
}
if (!this.oldRequest.hashTree) {
this.oldRequest.hashTree = [];
if (!this.newRequest.hashTree) {
this.newRequest.hashTree = [];
}
if (this.oldRequest.body && !this.oldRequest.body.binary) {
this.oldRequest.body.binary = [];
if (this.newRequest.body && !this.newRequest.body.binary) {
this.newRequest.body.binary = [];
}
//
if (this.oldResponse.body) {
if (this.newResponse.body) {
let body = new Body();
Object.assign(body, this.oldResponse.body);
Object.assign(body, this.newResponse.body);
if (!body.binary) {
body.binary = [];
}
@ -441,11 +441,11 @@ export default {
if (!body.binary) {
body.binary = [];
}
this.oldResponse.body = body;
this.newResponse.body = body;
}
this.oldRequest.clazzName = TYPE_TO_C.get(this.oldRequest.type);
this.newRequest.clazzName = TYPE_TO_C.get(this.newRequest.type);
this.sort(this.oldRequest.hashTree);
this.sort(this.newRequest.hashTree);
},
sort(stepArray) {
if (stepArray) {