MCPcopy Index your code
hub / github.com/labstack/echo / ParamOr

Method ParamOr

context.go:295–297  ·  view source on GitHub ↗

ParamOr returns the path parameter or default value for the provided name. Notes for DefaultRouter implementation: Path parameter could be empty for cases like that: * route `/release-:version/bin` and request URL is `/release-/bin` * route `/api/:version/image.jpg` and request URL is `/api//image.

(name, defaultValue string)

Source from the content-addressed store, hash-verified

293// but not when path parameter is last part of route path
294// * route `/download/file.:ext` will not match request `/download/file.`
295func (c *Context) ParamOr(name, defaultValue string) string {
296 return c.pathValues.GetOr(name, defaultValue)
297}
298
299// PathValues returns path parameter values.
300func (c *Context) PathValues() PathValues {

Callers 1

Calls 1

GetOrMethod · 0.80

Tested by 1