I have method in my rest controller
@PostMapping("/access") public ResponseEntity<?> login(@Valid @RequestBody LoginRequestDto loginRequestDto) { try { return ResponseEntity.ok(authService.login(loginRequestDto)); } catch (Exception exception) { return ResponseEntity.status(401).body(exception.getMessage()); } }
When my method throw error, this method return response with status 401 but without response message (in dev tools blank screen in response body). When I logged this response, response body is Readable stream.
I go through same questions but any answer didnt help me.
For example I have in my application yml
error: include-message: always include-binding-errors: always
I also tried to return any valid object in response body because I thought problem in return single String but no, when I return object, in dev tools I have blank response body.