mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Polish
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user