Skip to content

Improvment: OkOrNotFound controller base class method. #274

@rcollette

Description

@rcollette

I think it would be a better example for your readers to have a controller base class method like:

private static final NOT_FOUND = ResponseEntity.notFound().build();

protected Mono<ResponseEntity<T>> OkOrNotFound(Mono<T> result){
  return result.map(ResponseEntity::ok).defaultIfEmpty(NOT_FOUND);
}

In use it's now just

return OkOrNotFound(result);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions