mirror of https://github.com/gofiber/fiber.git
Stale isEqual for now
parent
3cea91e3da
commit
5c619e872c
|
@ -83,7 +83,7 @@ func (r *Route) matchRoute(method, path string) (match bool, values []string) {
|
|||
// non-middleware route, http method must match!
|
||||
// the wildcard method is for .All() & .Use() methods
|
||||
// If route is GET, also match HEAD requests
|
||||
if r.Method == method || r.Method[0] == '*' || (r.isGet && isEqual(method, "HEAD")) {
|
||||
if r.Method == method || r.Method[0] == '*' || (r.isGet && len(method) == 4 && method == "HEAD") {
|
||||
// '*' means we match anything
|
||||
if r.isStar {
|
||||
return true, values
|
||||
|
@ -109,7 +109,7 @@ func (r *Route) matchRoute(method, path string) (match bool, values []string) {
|
|||
return true, values
|
||||
}
|
||||
// last thing to do is to check for a simple path match
|
||||
if isEqual(r.Path, path) {
|
||||
if len(r.Path) == len(path) && r.Path == path {
|
||||
return true, values
|
||||
}
|
||||
}
|
||||
|
|
12
utils.go
12
utils.go
|
@ -41,12 +41,12 @@ func groupPaths(prefix, path string) string {
|
|||
|
||||
// BenchmarkDefault 322504144 18.6 ns/op // string == string
|
||||
// BenchmarkisEqual 353663168 17.0 ns/op // isEqual(string, string)
|
||||
func isEqual(a, b string) bool {
|
||||
if len(a) == len(b) {
|
||||
return a == b
|
||||
}
|
||||
return false
|
||||
}
|
||||
// func isEqual(a, b string) bool {
|
||||
// if len(a) == len(b) {
|
||||
// return a == b
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
|
||||
func getParams(path string) (params []string) {
|
||||
if len(path) < 1 {
|
||||
|
|
Loading…
Reference in New Issue