-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Combining two related issues here. Please let me know if that is not fine, will create separate issues.
Issue 1: Path values are not correct
Endpoint: /payments/{id: [0-9]{4}}*
Request Path: /payments/4765_payID/status
Expected Path Keys and Values: { "id" : "4765", "*" : "_payID/status" }
Actual Path Keys and Values: `{ "id": "", "*": "4765_payID/status" }
I am sure there are other ways to register the same route like /payments/{id: [0-9]{4}}{local_wildcard}/*
to handle the above cases but this doesn't allow /payments/1234_payID
work around is to define two routes in that case. We are facing this issue as we are migrating from another router ( lua based ) to Chi and we want to keep the routes backward compatible. Does it make sense to support this usecase ? If so then i can take a initial look at this and raise a PR for the same.
Issue 2: Extension to the Issue 1, Wildcard endpoint is ignored
- Endpoint 1 :
/payments/{id: [0-9]{4}}*
- Endpoint 2:
/payments/{id: [0-9]{4}}/status
Request Path: /payments/4765_payID/not_status
Expected Status Code : 200
( Path Matched )
Actual Status Code: 404
( No route matched )
When there are multiple childs along with wildcard, it follows the path without wildcard in this case. I was thinking why not add *
also in the sort function here to push the wildcards to the last ( tried locally, works fine). Please share your thoughts, i can raise the PR for the same