************************************/ ************ INPUT DATA ************/ ************************************/ Param returns the value of the URL param. It is a shortcut for c.Params.ByName(key) router.GET("/user/:id", func(c *gin.Context) { // a GET request to /user/john id := c.Para
(key string)
| 501 | // id := c.Param("id") // id == "/john/" |
| 502 | // }) |
| 503 | func (c *Context) Param(key string) string { |
| 504 | return c.Params.ByName(key) |
| 505 | } |
| 506 | |
| 507 | // AddParam adds param to context and |
| 508 | // replaces path param key with given value for e2e testing purposes |