(pv *PathValues)
| 317 | } |
| 318 | |
| 319 | func (c *Context) setPathValues(pv *PathValues) { |
| 320 | // Router accesses c.pathValues by index and may resize it to full capacity during routing |
| 321 | // for that to work without going out-of-bounds we must make sure that c.pathValues slice is not replaced with smaller |
| 322 | // slice than Router can set when routing Route with maximum amount of parameters. |
| 323 | pathValues := c.pathValues |
| 324 | if cap(*c.pathValues) < len(*pv) { |
| 325 | // normally we should not end up here. pathValues is normally sized to Echo.contextPathParamAllocSize which should not |
| 326 | // be smaller than anything router knows as maximum path parameter count to be. |
| 327 | tmp := make(PathValues, len(*pv)) |
| 328 | c.pathValues = &tmp |
| 329 | pathValues = c.pathValues |
| 330 | } else if len(*c.pathValues) != len(*pv) { |
| 331 | *pathValues = (*pathValues)[0:len(*pv)] // resize slice to given params length for copy to work |
| 332 | } |
| 333 | copy(*pathValues, *pv) |
| 334 | } |
| 335 | |
| 336 | // QueryParam returns the query param for the provided name. |
| 337 | func (c *Context) QueryParam(name string) string { |
no outgoing calls
no test coverage detected