Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to return HttpStatus 204 in Mono webflux

It's possible return a Mono<Object> with statusCode 204 (NO_CONTENT)?

I need that, for example postman show something like this: enter image description here

like image 810
jdflores Avatar asked Dec 07 '25 05:12

jdflores


1 Answers

If using a Controller, this should do (replace path, method, etc as needed):

   @GetMapping(value = "/no-content")
   @ResponseStatus(HttpStatus.NO_CONTENT)
   @ResponseBody
   public Mono<Object> noContentMethod()
   {
      // ... processing here ...
      return Mono.empty();
   }
like image 178
gears Avatar answered Dec 08 '25 20:12

gears