This commit is contained in:
Brian Clozel 2018-08-15 20:56:27 +02:00
parent 23fc6f6b1d
commit cd403f4180
1 changed files with 1 additions and 0 deletions

View File

@ -223,6 +223,7 @@ public class ResponseEntity<T> extends HttpEntity<T> {
* @since 5.1
*/
public static <T> ResponseEntity<T> of(Optional<T> body) {
Assert.notNull(body, "Body must not be null");
return body.map(ResponseEntity::ok).orElse(notFound().build());
}