Added more tests for URI's without a parameter
[demos/testing] / src / main / java / de / juplo / demo / HtmlController.java
index d26c8c5..ec5919c 100644 (file)
@@ -24,14 +24,16 @@ public class HtmlController
   }
 
 
-  @GetMapping("/")
-  public String fetch(Model model, @RequestParam String path)
+  @GetMapping({ "", "/" })
+  public String fetch(Model model, @RequestParam(required = false) String path)
   {
     model.addAttribute(
         "text",
-        service
-            .getRemoteText(path)
-            .onErrorResume(t -> Mono.just(t.getMessage())));
+        path == null
+            ? ""
+            : service
+                  .getRemoteText(path)
+                  .onErrorResume(t -> Mono.just(t.getMessage())));
     return "home";
   }
 }