MCPcopy
hub / github.com/labstack/echo / add

Method add

echo.go:692–709  ·  view source on GitHub ↗
(route Route)

Source from the content-addressed store, hash-verified

690}
691
692func (e *Echo) add(route Route) (RouteInfo, error) {
693 if e.OnAddRoute != nil {
694 if err := e.OnAddRoute(route); err != nil {
695 return RouteInfo{}, err
696 }
697 }
698
699 ri, err := e.router.Add(route)
700 if err != nil {
701 return RouteInfo{}, err
702 }
703
704 paramsCount := int32(len(ri.Parameters)) // #nosec G115
705 if paramsCount > e.contextPathParamAllocSize.Load() {
706 e.contextPathParamAllocSize.Store(paramsCount)
707 }
708 return ri, nil
709}
710
711// Add registers a new route for an HTTP method and path with matching handler
712// in the router with optional route-level middleware.

Callers 3

AddRouteMethod · 0.95
AddMethod · 0.95
AddRouteMethod · 0.80

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected