len(path) moved down to where it is used.
This commit is contained in:
parent
3e6d03db1a
commit
32e7468eef
3
httpr.go
3
httpr.go
@ -38,14 +38,13 @@ func newPath(path string) (path, error) {
|
||||
|
||||
// newServePath is a reduced version of newPath for ServeHTTP.
|
||||
func newServePath(path string) (path, error) {
|
||||
pathLen := len(path)
|
||||
|
||||
if path[0] != '/' {
|
||||
return nil, errors.New("path should start with a slash symbol \"/\"")
|
||||
}
|
||||
|
||||
path = strings.ReplaceAll(path, "//", "/")
|
||||
|
||||
pathLen := len(path)
|
||||
if path[pathLen-1] == '/' {
|
||||
path = path[:pathLen-1]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user