go-chi / go-chi/chi

Allow slashes in path params

Open
#1,106 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.