Closed Tieske closed 6 months ago
I got tricked for a while, as I had forgotten that the string paths were regular expressions. This post is left for other users who may wonder why pegas is not serving matching the expected path.
Any of the "magic characters"
( ) . % + - * ? [ ^ $
Need to be escaped with %, for example the route "/catch-fish"
local routes = {
["/catch%-fish"] = {
GET = function(req, resp)
resp:statusCode(200)
resp:addHeader("Content-Type","text/html")
resp:write("catch")
end,
},
I do not consider this a bug, its likely a bug in my comprehension.
@wmealing I think that's actually a bug, we should (for simplicity sake) escape the path before matching. Such that a path "/my-cool-path/{parameter}"
can be used without manually escaping the "-
" characters.
Other things:
"{parameter+}"
where the "+" means matching more than 1 segment (normally parameters are limited to 1 segment)"/my%20path"
should match a configured router path "/my path"
(also applies to the path-prefix on router level)Any input appreciated.
This builds on top of #130
Adds a router plugin.