How do we access the HTTP status code that we have already returned in the finally block.
For example, in the below snippet, how can we get returned HTTP status code in logResponseStatus?
public ResponseEntity<SampleResponse> sampleAPI() {
try{
return new ResponseEntity<>(new SampleResponse(), HttpStatus.OK);
} finally {
logResponseStatus();
}
}
void logResponseStatus(HttpStatus status) {
// ...
}