refactor(接口测试): 请求体选择的请求格式以请求头填写优先

This commit is contained in:
chenjianxing 2020-10-30 14:37:00 +08:00
parent 713257c4d5
commit d1fc4b4cdd

View File

@ -1363,15 +1363,19 @@ class JMXGenerator {
}
addContentType(request, type) {
let hasContentType = false;
for (let index in request.headers) {
if (request.headers.hasOwnProperty(index)) {
if (request.headers[index].name === 'Content-Type') {
if (request.headers[index].name === 'Content-Type' && request.headers[index].enable != false) {
request.headers.splice(index, 1);
hasContentType = true;
break;
}
}
}
request.headers.push(new KeyValue({name: 'Content-Type', value: type}));
if (!hasContentType) {
request.headers.push(new KeyValue({name: 'Content-Type', value: type}));
}
}
addRequestArguments(httpSamplerProxy, request) {