[ch33079] Fixed the route parser

This commit is contained in:
Talal 2020-07-30 12:18:12 +02:00
parent 3c33e95efd
commit ccb3bfa385
1 changed files with 3 additions and 1 deletions

View File

@ -81,7 +81,9 @@ func (r Router) Invoke(ctx context.Context, payload []byte) ([]byte, error) {
path := req.Path path := req.Path
for param, value := range req.PathParameters { 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)) i, found := r.events.Get([]byte(req.HTTPMethod + path))