Warn about ResponseEntity-ProblemDetail status mismatch
Closes gh-29378
This commit is contained in:
@@ -159,6 +159,13 @@ public class ResponseEntityResultHandler extends AbstractMessageWriterResultHand
|
||||
URI path = URI.create(exchange.getRequest().getPath().value());
|
||||
detail.setInstance(path);
|
||||
}
|
||||
if (logger.isWarnEnabled() && httpEntity instanceof ResponseEntity<?> responseEntity) {
|
||||
if (responseEntity.getStatusCode().value() != detail.getStatus()) {
|
||||
logger.warn(actualParameter.getExecutable().toGenericString() +
|
||||
" returned ResponseEntity: " + responseEntity + ", but its status" +
|
||||
" doesn't match the ProblemDetail status: " + detail.getStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (httpEntity instanceof ResponseEntity<?> responseEntity) {
|
||||
|
||||
@@ -197,6 +197,13 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro
|
||||
URI path = URI.create(inputMessage.getServletRequest().getRequestURI());
|
||||
detail.setInstance(path);
|
||||
}
|
||||
if (logger.isWarnEnabled() && httpEntity instanceof ResponseEntity<?> responseEntity) {
|
||||
if (responseEntity.getStatusCode().value() != detail.getStatus()) {
|
||||
logger.warn(returnType.getExecutable().toGenericString() +
|
||||
" returned ResponseEntity: " + responseEntity + ", but its status" +
|
||||
" doesn't match the ProblemDetail status: " + detail.getStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HttpHeaders outputHeaders = outputMessage.getHeaders();
|
||||
|
||||
Reference in New Issue
Block a user