对于运行 Spring Boot 1.5.2 的 Spring Boot 应用程序,我有一个类似于以下内容的 handleRequest() 方法:
@RequestMapping(path = "/my/path/endpoint", method = RequestMethod.POST, consumes = { "text/*", "application/json" })
@ResponseStatus(HttpStatus.Accepted)
public void handleRequest(@RequestBody String body, @RequestHeader(HttpHeaders.CONTENT_TYPE) Object contentType, @RequestHeader HttpHeaders headers) throws IllegalArgumentException, JsonProcessingException {
if( //I'm missing a required header ) {
throw new CustomExceptionThatExtendsRuntimeException("missing my header");
}
/*
do more stuff here
*/
}
如果我的 IF 语句为真并且我在方法主体中抛出 RuntimeException,那么返回的 HTTP 响应代码是什么?