refactor(接口测试): 请求体选择的请求格式以请求头填写优先
This commit is contained in:
parent
713257c4d5
commit
d1fc4b4cdd
|
@ -1363,16 +1363,20 @@ class JMXGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
addContentType(request, type) {
|
addContentType(request, type) {
|
||||||
|
let hasContentType = false;
|
||||||
for (let index in request.headers) {
|
for (let index in request.headers) {
|
||||||
if (request.headers.hasOwnProperty(index)) {
|
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);
|
request.headers.splice(index, 1);
|
||||||
|
hasContentType = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!hasContentType) {
|
||||||
request.headers.push(new KeyValue({name: 'Content-Type', value: type}));
|
request.headers.push(new KeyValue({name: 'Content-Type', value: type}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addRequestArguments(httpSamplerProxy, request) {
|
addRequestArguments(httpSamplerProxy, request) {
|
||||||
let args = this.filterKV(request.parameters);
|
let args = this.filterKV(request.parameters);
|
||||||
|
|
Loading…
Reference in New Issue