Skip to content

Commit 1d07729

Browse files
authored
chore: updates lesson_26 code to hint at ResponseEntity (#681)
* chore: adds hint for ResponseEntity * chore: apply spotless
1 parent f2f7ea4 commit 1d07729

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lesson_26/api/java/api_app/src/main/java/com/codedifferently/lesson26/web/MediaItemsController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
import java.io.IOException;
88
import java.util.List;
99
import java.util.Set;
10+
import org.springframework.http.ResponseEntity;
1011
import org.springframework.web.bind.annotation.CrossOrigin;
1112
import org.springframework.web.bind.annotation.GetMapping;
1213
import org.springframework.web.bind.annotation.RestController;
1314

1415
@RestController
1516
@CrossOrigin
1617
public class MediaItemsController {
18+
1719
private final Library library;
1820
private final Librarian librarian;
1921

@@ -23,10 +25,10 @@ public MediaItemsController(Library library) throws IOException {
2325
}
2426

2527
@GetMapping("/items")
26-
public GetMediaItemsResponse getItems() {
28+
public ResponseEntity<GetMediaItemsResponse> getItems() {
2729
Set<MediaItem> items = library.search(SearchCriteria.builder().build());
2830
List<MediaItemResponse> responseItems = items.stream().map(MediaItemResponse::from).toList();
2931
var response = GetMediaItemsResponse.builder().items(responseItems).build();
30-
return response;
32+
return ResponseEntity.ok(response);
3133
}
3234
}

0 commit comments

Comments
 (0)