新增禁止验证RequestBody的接口选项
This commit is contained in:
parent
9f5374fa3a
commit
1bf5769acf
@ -40,7 +40,12 @@ public enum Options {
|
||||
/**
|
||||
* 不接收未经定义的参数
|
||||
*/
|
||||
DISABLED_UNKNOWN_PARAMETER("不接收未经定义的参数", "disabled_unknown_parameter", "true");
|
||||
DISABLED_UNKNOWN_PARAMETER("不接收未经定义的参数", "disabled_unknown_parameter", "true"),
|
||||
|
||||
/**
|
||||
* 禁止验证requestBody
|
||||
*/
|
||||
DISABLED_VALIDATE_REQUEST_BODY("禁止验证RequestBody", "disabled_validate_request_body", "false");
|
||||
|
||||
private final String name;
|
||||
private final String value;
|
||||
|
||||
@ -150,7 +150,7 @@ public class RequestHandler extends MagicController {
|
||||
context.set(VAR_NAME_REQUEST_BODY, bodyValue);
|
||||
}
|
||||
BaseDefinition requestBody = info.getRequestBodyDefinition();
|
||||
if (requestBody != null && !CollectionUtils.isEmpty(requestBody.getChildren())) {
|
||||
if (requestBody != null && !CONST_STRING_TRUE.equalsIgnoreCase(info.getOptionValue(Options.DISABLED_VALIDATE_REQUEST_BODY)) && !CollectionUtils.isEmpty(requestBody.getChildren())) {
|
||||
requestBody.setName(StringUtils.defaultIfBlank(requestBody.getName(), "root"));
|
||||
doValidate(scriptName, VAR_NAME_REQUEST_BODY, Collections.singletonList(requestBody), new HashMap<String, Object>() {{
|
||||
put(requestBody.getName(), bodyValue);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user