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

View File

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

View File

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

View File

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