Commit 89d0bd8cb532f1c32251161436ff7cde76cbdf3c

Thomas de Grivel 2024-09-18T22:21:44

fix test/httpd

diff --git a/httpd/fx/config/routes.kc3 b/httpd/fx/config/routes.kc3
index f0eb174..b65ce22 100644
--- a/httpd/fx/config/routes.kc3
+++ b/httpd/fx/config/routes.kc3
@@ -2,4 +2,4 @@ def HTTPd.routes = []
 
 def_route("/fx/", FXController.route)
 def_static_route("/file", "./fx/", 1)
-def_static_route("/", "./static/", 0)
+def_static_route("", "./static/", 0)
diff --git a/lib/kc3/0.1/httpd.kc3 b/lib/kc3/0.1/httpd.kc3
index a51a8cf..a4dbaf9 100644
--- a/lib/kc3/0.1/httpd.kc3
+++ b/lib/kc3/0.1/httpd.kc3
@@ -207,9 +207,14 @@ defmodule HTTPd do
   }
 
   def url_eat = fn {
-    ([first | rest], 0) { List.join([first | rest], "/") }
     ([], 0) { "" }
-    (url, 0) { url }
+    (url, 0) {
+      if (type(url) == List) do
+        List.join(url, "/")
+      else
+        url
+      end
+    }
     ([first | rest], i) { url_eat(rest, i - 1) }
     ([], i) { "" }
     (url, i) { "/" + url_eat(Str.split(url, "/"), i + 1) }
@@ -287,6 +292,6 @@ defmodule HTTPd do
     def_route(prefix, route)
   }
 
-  def_static_route("/", "./static/", 0)
+  def_static_route("", "./static/", 0)
 
 end
diff --git a/test/httpd/config/routes.kc3 b/test/httpd/config/routes.kc3
index 31bcc6f..0312223 100644
--- a/test/httpd/config/routes.kc3
+++ b/test/httpd/config/routes.kc3
@@ -1,4 +1,5 @@
 def HTTPd.routes = []
 
 def_route("/doc/", DocController.route)
-def_route("/", static_controller("./static/", 0))
+
+def_static_route("", "./static/", 0)