出于安全原因,如果URI请求长度大于400
个字符,我需要返回1024
错误。
有没有办法在Spring Boot中测试它?
目前我有一个简单的Controller对查询字符串和标题参数进行验证
@RestController
@Validated
public class myController {
@RequestMapping(value = "{id}", method = GET)
public SegmentationResponse getSegments(
@PathVariable("id") @Valid @Size(min = 12) String id,
@RequestHeader(value = "X-API-Key", required = true) @ValidAPIKey String apiKeyHeader,
@RequestParam(value = "myParam", required = true) @Valid @Pattern(regexp = MY_REGEX) String myParam) {
// DO Stuff
}
}
所需
http://localhost:8080/<More than 1024 chars here>
返回400 Bad Request