Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
Captain.B 2020-11-05 17:18:58 +08:00
commit c3c79dd929
2 changed files with 32 additions and 7 deletions

View File

@ -251,7 +251,7 @@ public class UserController {
* 组织成员列表不分页 * 组织成员列表不分页
*/ */
@PostMapping("/org/member/list/all") @PostMapping("/org/member/list/all")
@RequiresRoles(value = {RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public List<User> getOrgMemberList(@RequestBody QueryOrgMemberRequest request) { public List<User> getOrgMemberList(@RequestBody QueryOrgMemberRequest request) {
return userService.getOrgMemberList(request); return userService.getOrgMemberList(request);
} }

View File

@ -1198,16 +1198,25 @@ class JMXGenerator {
} }
addEnvironments(environments, target) { addEnvironments(environments, target) {
let keys = new Set(); let targetMap = new Map();
target.forEach(item => { target.forEach(item => {
keys.add(item.name); if (item.name) {
targetMap.set(item.name, item.enable);
}
}); });
let envArray = environments; let envArray = environments;
if (!(envArray instanceof Array)) { if (!(envArray instanceof Array)) {
envArray = JSON.parse(environments); envArray = JSON.parse(environments);
} }
envArray.forEach(item => { envArray.forEach(item => {
if (item.enable != false && item.name && !keys.has(item.name)) { let targetItem = targetMap.get(item.name);
let hasItem = undefined;
if (targetItem) {
hasItem = (targetItem.enable === false ? false : true);
} else {
hasItem = false;
}
if (item.enable != false && item.name && !hasItem) {
target.push(new KeyValue({name: item.name, value: item.value})); target.push(new KeyValue({name: item.name, value: item.value}));
} }
}) })
@ -1311,7 +1320,10 @@ class JMXGenerator {
if (!(scenario.environment.config instanceof Object)) { if (!(scenario.environment.config instanceof Object)) {
config = JSON.parse(scenario.environment.config); config = JSON.parse(scenario.environment.config);
} }
this.addEnvironments(config.httpConfig.headers, request.headers) this.addEnvironments(config.httpConfig.headers, request.headers);
if (request.doMultipartPost) {
this.removeContentType(request);
}
} }
let name = request.name + " Headers"; let name = request.name + " Headers";
this.addBodyFormat(request); this.addBodyFormat(request);
@ -1403,6 +1415,17 @@ class JMXGenerator {
} }
} }
removeContentType(request) {
for (let index in request.headers) {
if (request.headers.hasOwnProperty(index)) {
if (request.headers[index].name === 'Content-Type' && request.headers[index].enable != false) {
request.headers.splice(index, 1);
break;
}
}
}
}
addRequestArguments(httpSamplerProxy, request) { addRequestArguments(httpSamplerProxy, request) {
let args = this.filterKV(request.parameters); let args = this.filterKV(request.parameters);
if (args.length > 0) { if (args.length > 0) {
@ -1416,11 +1439,13 @@ class JMXGenerator {
body = this.filterKV(request.body.kvs); body = this.filterKV(request.body.kvs);
this.addRequestBodyFile(httpSamplerProxy, request, testId); this.addRequestBodyFile(httpSamplerProxy, request, testId);
} else { } else {
body.push({name: '', value: request.body.raw, encode: false, enable: true}); if (request.body.raw) {
httpSamplerProxy.boolProp('HTTPSampler.postBodyRaw', true);
body.push({name: '', value: request.body.raw, encode: false, enable: true});
}
} }
if (request.method !== 'GET') { if (request.method !== 'GET') {
httpSamplerProxy.boolProp('HTTPSampler.postBodyRaw', true);
httpSamplerProxy.add(new HTTPSamplerArguments(body)); httpSamplerProxy.add(new HTTPSamplerArguments(body));
} }
} }