1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-29 22:48:07 +02:00

Allow escaping of colon in route path so Google Cloud API "custom methods" https://cloud.google.com/apis/design/custom_methods can be implemented (resolves #1987) (#1988)

Allow escaping of colon in route path so Google Cloud API "custom methods" https://cloud.google.com/apis/design/custom_methods could be implemented (resolves #1987)
This commit is contained in:
Martti T
2021-09-19 11:39:12 +03:00
committed by GitHub
parent f6b45f2376
commit 9fc4672195
2 changed files with 55 additions and 0 deletions

View File

@@ -98,6 +98,9 @@ func (r *Router) Add(method, path string, h HandlerFunc) {
for i, lcpIndex := 0, len(path); i < lcpIndex; i++ {
if path[i] == ':' {
if i > 0 && path[i-1] == '\\' {
continue
}
j := i + 1
r.insert(method, path[:i], nil, staticKind, "", nil)