URLParam returns the url parameter from a http.Request object.
(r *http.Request, key string)
| 8 | |
| 9 | // URLParam returns the url parameter from a http.Request object. |
| 10 | func URLParam(r *http.Request, key string) string { |
| 11 | if rctx := RouteContext(r.Context()); rctx != nil { |
| 12 | return rctx.URLParam(key) |
| 13 | } |
| 14 | return "" |
| 15 | } |
| 16 | |
| 17 | // URLParamFromCtx returns the url parameter from a http.Request Context. |
| 18 | func URLParamFromCtx(ctx context.Context, key string) string { |