Unclear behaviour of `*` in routes
@aldas 已经在做这个了。
开始于 2024年4月6日。
评估
这个 Issue 还没有评估数据。
描述
Issue Description
Checklist
- Dependencies installed
- No typos
- Searched existing issues and docs
Expected behaviour
- If I have static text in a route that static text is guaranteed to show up in
c.Path()orc.Request().RequestURI - Multiple instances of
*in routes play nicely with each other
Actual behaviour
- If I have static text in a route, another route with
*may "absorb it" - Multiple instances of
*in routes do NOT seem to play nicely with each other
Steps to reproduce
Trying to build router for: https://github.com/opencontainers/distribution-spec/blob/main/spec.md
handler := func (c echo.Context) err {
fmt.Printf("%s\n", c.Path())
}
e := echo.New()
v2 := e.Group("/v2")
v2.DELETE("/*/blobs/:digest", handler)
v2.GET("/*/blobs/:digest", handler)
v2.HEAD("/*/blobs/:digest", handler)
v2.DELETE("/*/manifests/:ref", handler)
v2.GET("/*/manifests/:ref", handler)
v2.HEAD("/*/manifests/:ref", handler)
v2.PUT("/*/manifests/:ref", handler)
v2.GET("/*/tags/list", handler)
v2.GET("/*/blobs/uploads/:ref", handler)
v2.PATCH("/*/blobs/uploads/:ref", handler)
v2.POST("/*/blobs/uploads", handler)
v2.PUT("/*/blobs/uploads/:ref", handler)
v2.GET("", handler)
Run:
curl -ik https://localhost:8080/v2/foo/bar/baz/tags/list
# /v2/*/blobs/uploads/:ref
Result outputs /v2/*/blobs/uploads/:ref when it should output /v2/*/tags/list.
Version/commit
v4.11.4
- 主要语言
- Go
- 星标
- 32.7k
- 派生
- 2.8k
- 平均合并
- 9 小时 39 分钟
- 30 天内合并 PR
- 6
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
labstack/echo 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
-
难度 3/5 1-2 天 新手友好度 65/100
-
难度 3/5 1-2 天 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 74/100
-
难度 5/5 一周以上 新手友好度 35/100
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 60/100
github/gh-aw-mcpg#13748 ·
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 65/100
-
needs-triage
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 75/100
googleapis/librarian#7670 · 2 条评论 ·