Changed error messages in newPath().

This commit is contained in:
Alexander Andreev 2023-08-12 18:55:00 +04:00
parent 468606e4fd
commit 7c8baeecf5
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -13,11 +13,11 @@ type path []string
// have more than 1 catch-all parameter. // have more than 1 catch-all parameter.
func newPath(path string) (path, error) { func newPath(path string) (path, error) {
if path[0] != '/' { if path[0] != '/' {
return nil, errors.New("path should start with a slash (/) symbol") return nil, errors.New("path should start with a slash symbol \"/\"")
} }
if strings.Count(path, "*") > 1 { if strings.Count(path, "*") > 1 {
return nil, errors.New("there can be only one catch-all (*) parameter in path") return nil, errors.New("path can have only one catch-all parameter \"*\"")
} }
path = strings.ReplaceAll(path, "//", "/") path = strings.ReplaceAll(path, "//", "/")