Allow slashes in path params
- Dominant language
- Go
- Stars
- 22.8k
- Forks
- 1.2k
- Avg merge
- 5h 17m
- Merged PRs (30d)
- 10
Description
this has been brought up in previous (closed) issues such as #174 and #566.
there are some situations where this could be useful. an example would be a filesystem browser + editor, with routes that correspond to the file's path like so:
- GET `/files/{path:*}/edit`
- DELETE `/files/{path:*}/delete`
- POST `/files/{path:*}/upload`
`path:*` would match 0 or more path segments, meaning the following urls are valid:
- `/files/one/two/three/four/edit`
- `/files/foo/bar.txt/edit`
- `/files/upload`
i'm willing to open a PR to implement this.
Contributor guide
Research direction
Start by reviewing the prior discussions in issues #174 and #566, then trace how chi currently matches path parameters. Use the filesystem-browser examples in this issue to define the supported `path:*` behavior, including zero or more segments and paths containing slashes. Done means the listed GET, DELETE, and POST route patterns match the valid URLs without breaking existing routing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100