claude code review changes
This commit is contained in:
12
resource.go
12
resource.go
@@ -27,7 +27,7 @@ func (m *Mux) Resource(pattern string, fn func(res *Resource), mw ...func(http.H
|
||||
}
|
||||
|
||||
if strings.TrimSpace(pattern) == "" {
|
||||
panic("mux: Resource() requires a patter to work")
|
||||
panic("mux: Resource() requires a pattern to work")
|
||||
}
|
||||
|
||||
if fn == nil {
|
||||
@@ -215,11 +215,9 @@ func (res *Resource) Use(middlewares ...func(http.Handler) http.Handler) {
|
||||
}
|
||||
|
||||
func suffixIt(str, suffix string) string {
|
||||
var p strings.Builder
|
||||
p.WriteString(str)
|
||||
if !strings.HasSuffix(str, "/") {
|
||||
p.WriteString("/")
|
||||
if strings.HasSuffix(str, "/") {
|
||||
return str + suffix
|
||||
}
|
||||
p.WriteString(suffix)
|
||||
return p.String()
|
||||
|
||||
return str + "/" + suffix
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user