-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Routing: path containing underscore "_" in path path variable fails to route #871
Comments
Since they are just strings it doesn't seem necessary to limit to valid identifiers. Perhaps something like diff --git a/src/Handlers.jl b/src/Handlers.jl
index bcb8bc8..d138d27 100644
--- a/src/Handlers.jl
+++ b/src/Handlers.jl
@@ -145,7 +145,7 @@ mutable struct Variable
pattern::Union{Nothing, Regex}
end
-const VARREGEX = r"^{([[:alnum:]]+):?(.*)}$"
+const VARREGEX = r"^{([^:]+)(?::(.*))}$"
function Variable(pattern)
re = Base.match(VARREGEX, pattern)
@@ -178,7 +178,7 @@ end
Base.show(io::IO, x::Node) = print(io, "Node($(x.segment))")
isvariable(x) = startswith(x, "{") && endswith(x, "}")
-segment(x) = segment == "*" ? String(segment) : isvariable(x) ? Variable(x) : String(x)
+segment(x) = isvariable(x) ? Variable(x) : String(x) would work? |
Is there no reason for limiting the string to |
I think I ended up coping the @fredrikekre, mind making a PR w/ your patch? |
Using a path variable with an underscore registers a path successfully, but then fails to match the path to a request. For example, consider the simple server example:
Changing the path variable from
id
toanimal_id
:leads to the following error:
I can try to prepare a PR, but I am not sure what should actually happen. In my opinion, either
register!
should throw an error when trying to register a path with not allowed characters path variables,Versions:
The text was updated successfully, but these errors were encountered: