MCPcopy
hub / github.com/gofiber/fiber / getLocationFromRoute

Method getLocationFromRoute

res.go:650–656  ·  view source on GitHub ↗

getLocationFromRoute gets the URL location from a route using parameters. Nil receivers and missing routes return ErrNotFound to match Route.URL semantics.

(route *Route, params Map)

Source from the content-addressed store, hash-verified

648// getLocationFromRoute gets the URL location from a route using parameters.
649// Nil receivers and missing routes return ErrNotFound to match Route.URL semantics.
650func (r *DefaultRes) getLocationFromRoute(route *Route, params Map) (string, error) {
651 if r == nil || route == nil || route.Path == "" {
652 return "", ErrNotFound
653 }
654
655 return buildRouteURL(route, params)
656}
657
658// GetRouteURL generates URLs to named routes, with parameters. URLs are relative, for example: "/user/1831"
659func (r *DefaultRes) GetRouteURL(routeName string, params Map) (string, error) {

Callers 1

GetRouteURLMethod · 0.95

Calls 1

buildRouteURLFunction · 0.85

Tested by

no test coverage detected