diff --git a/mux/router.go b/mux/router.go index d72e8301..2bcafe07 100644 --- a/mux/router.go +++ b/mux/router.go @@ -9,6 +9,7 @@ import ( "github.com/plgd-dev/go-coap/v3/message" "github.com/plgd-dev/go-coap/v3/message/codes" "github.com/plgd-dev/go-coap/v3/message/pool" + "golang.org/x/exp/maps" // TODO: switch to non-exp maps package when dependency hits 1.20 ) type ResponseWriter = interface { @@ -201,7 +202,7 @@ func (r *Router) GetRoute(pattern string) *Route { func (r *Router) GetRoutes() map[string]Route { r.m.RLock() defer r.m.RUnlock() - return r.z + return maps.Clone(r.z) } // ServeCOAP dispatches the request to the handler whose