From ccb3bfa385e4b8c525ed6619de1a107e981ed936 Mon Sep 17 00:00:00 2001 From: Talal Date: Thu, 30 Jul 2020 12:18:12 +0200 Subject: [PATCH] [ch33079] Fixed the route parser --- router.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/router.go b/router.go index 8e1fcf6..1df71f4 100644 --- a/router.go +++ b/router.go @@ -81,7 +81,9 @@ func (r Router) Invoke(ctx context.Context, payload []byte) ([]byte, error) { path := req.Path for param, value := range req.PathParameters { - path = strings.Replace(path, value, "{"+param+"}", -1) + oldValue := fmt.Sprintf("/%s/", value) + newValue := fmt.Sprintf("/{%s}/", param) + path = strings.Replace(path, oldValue, newValue, -1) } i, found := r.events.Get([]byte(req.HTTPMethod + path))