QueryParam returns the query param for the provided name.
(name string)
| 335 | |
| 336 | // QueryParam returns the query param for the provided name. |
| 337 | func (c *Context) QueryParam(name string) string { |
| 338 | // If the full query map was already built (e.g. by QueryParams), use it. Otherwise look the single |
| 339 | // key up directly from the raw query, avoiding the url.Values map allocation for the common case of |
| 340 | // reading only a few params. The result is identical to url.Values.Get on the parsed query. |
| 341 | if c.query != nil { |
| 342 | return c.query.Get(name) |
| 343 | } |
| 344 | return getRawQueryParam(c.request.URL.RawQuery, name) |
| 345 | } |
| 346 | |
| 347 | // getRawQueryParam returns the first value for name parsed directly from a raw URL query string. It |
| 348 | // matches url.Values.Get over url.ParseQuery output: first match wins, '+' decodes to space, percent |