lib/nitcorn: force all routes path to begin with a "/" once registered
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 20 Apr 2016 17:48:14 +0000 (13:48 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 21 Apr 2016 17:19:21 +0000 (13:19 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/nitcorn/server_config.nit

index c2bd614..e61caad 100644 (file)
@@ -61,6 +61,12 @@ class Route
        # Path to this action present in the URI
        var path: nullable String
 
        # Path to this action present in the URI
        var path: nullable String
 
+       init
+       do
+               var path = path
+               if path != null then self.path = "/" / path
+       end
+
        # `Action` to activate when this route is traveled
        var handler: Action
 end
        # `Action` to activate when this route is traveled
        var handler: Action
 end