mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
refactor(接口测试): 请求体选择的请求格式以请求头填写优先
This commit is contained in:
parent
713257c4d5
commit
d1fc4b4cdd
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user