Changed error messages in newPath().
This commit is contained in:
parent
468606e4fd
commit
7c8baeecf5
4
httpr.go
4
httpr.go
@ -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, "//", "/")
|
||||||
|
Loading…
Reference in New Issue
Block a user