return only http status from the controller
hey guys. i want to ask for some help. i have a controller and i want it to return only http status and no body. can i do it this way?
it works, but i was wondering maybe smth can be done better? thx in advance
10 Replies
⌛
This post has been reserved for your question.
Hey @bambyzas! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Just return void
By default it will be a 200, unless authentication is wrong (4xx) or there's an exception (5xx)
yeah thats the officially endorsed way
i was told i can return ResponseEntity<Void> too
or put
@ResponseStatus(HttpStatus.NO_CONTENT)
and make my controller method return voidif you just want to return 200 or 204, then just return void and do nothing
actually i need to return 204 No Content
yeah thats what i meant
i forgot the code
ok
This
If you have a restcontroller, no need to put the produces in there either
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.