File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
lesson_26/api/java/api_app/src/main/java/com/codedifferently/lesson26/web Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 77import java .io .IOException ;
88import java .util .List ;
99import java .util .Set ;
10+ import org .springframework .http .ResponseEntity ;
1011import org .springframework .web .bind .annotation .CrossOrigin ;
1112import org .springframework .web .bind .annotation .GetMapping ;
1213import org .springframework .web .bind .annotation .RestController ;
1314
1415@ RestController
1516@ CrossOrigin
1617public 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}
You can’t perform that action at this time.
0 commit comments