I want to use the ResponseEntity without returning a body, only set status code and headers. The ResponseEntity is a generic class, do I need to specify the type in this case, and if, what should it be?
No you don't, just do something like this
ResponseEntity responseEntity = new ResponseEntity(HttpStatus.BAD_REQUEST);
You can use return ResponseEntity<Void>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With