URLParamFromCtx returns the url parameter from a http.Request Context.
(ctx context.Context, key string)
| 16 | |
| 17 | // URLParamFromCtx returns the url parameter from a http.Request Context. |
| 18 | func URLParamFromCtx(ctx context.Context, key string) string { |
| 19 | if rctx := RouteContext(ctx); rctx != nil { |
| 20 | return rctx.URLParam(key) |
| 21 | } |
| 22 | return "" |
| 23 | } |
| 24 | |
| 25 | // RouteContext returns chi's routing Context object from a |
| 26 | // http.Request Context. |