mirror of
https://github.com/kataras/iris.git
synced 2025-12-20 03:17:04 +00:00
I forgot to use sort.Sort lawl
This commit is contained in:
7
http.go
7
http.go
@@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@@ -1217,8 +1218,9 @@ func (mux *serveMux) register(method []byte, subdomain string, path string, midd
|
||||
// build collects all routes info and adds them to the registry in order to be served from the request handler
|
||||
// this happens once when server is setting the mux's handler.
|
||||
func (mux *serveMux) build() {
|
||||
routes := bySubdomain(mux.lookups)
|
||||
for _, r := range routes {
|
||||
|
||||
sort.Sort(bySubdomain(mux.lookups))
|
||||
for _, r := range mux.lookups {
|
||||
// add to the registry tree
|
||||
tree := mux.getTree(r.method, r.subdomain)
|
||||
if tree == nil {
|
||||
@@ -1260,7 +1262,6 @@ func (mux *serveMux) ServeRequest() fasthttp.RequestHandler {
|
||||
|
||||
// initialize the router once
|
||||
mux.build()
|
||||
|
||||
// optimize this once once, we could do that: context.RequestPath(mux.escapePath), but we lose some nanoseconds on if :)
|
||||
getRequestPath := func(reqCtx *fasthttp.RequestCtx) string {
|
||||
return utils.BytesToString(reqCtx.Path())
|
||||
|
||||
Reference in New Issue
Block a user