user1354825
user1354825

Reputation: 1521

ResponseEntity.ok() without response body?

How can i return a ResponseEntity with 200 status code and no body ?

I have a Http PUT method and i dont want to return a response body. I want to return only the status code.

Upvotes: 0

Views: 4954

Answers (1)

codebrane
codebrane

Reputation: 4630

@RequestMapping(method = RequestMethod.PUT, value = "/do/something")
public ResponseEntity doSomething() {
  return new ResponseEntity<>(null, HttpStatus.OK);
}

Upvotes: 2

Related Questions