MCPcopy
hub / github.com/go-chi/chi / URLParam

Function URLParam

context.go:10–15  ·  view source on GitHub ↗

URLParam returns the url parameter from a http.Request object.

(r *http.Request, key string)

Source from the content-addressed store, hash-verified

8
9// URLParam returns the url parameter from a http.Request object.
10func 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.
18func URLParamFromCtx(ctx context.Context, key string) string {

Callers 14

TestMuxBasicFunction · 0.85
TestMuxMountsFunction · 0.85
TestMuxTrailingSlashFunction · 0.85
bigMuxFunction · 0.85
TestMuxSubroutesBasicFunction · 0.85
TestSingleHandlerFunction · 0.85
TestMuxEmptyParamsFunction · 0.85
TestMuxMissingParamsFunction · 0.85
TestMuxRegexpFunction · 0.85
TestMuxRegexp2Function · 0.85
TestEscapedURLParamsFunction · 0.85

Calls 2

RouteContextFunction · 0.85
URLParamMethod · 0.80

Tested by 14

TestMuxBasicFunction · 0.68
TestMuxMountsFunction · 0.68
TestMuxTrailingSlashFunction · 0.68
bigMuxFunction · 0.68
TestMuxSubroutesBasicFunction · 0.68
TestSingleHandlerFunction · 0.68
TestMuxEmptyParamsFunction · 0.68
TestMuxMissingParamsFunction · 0.68
TestMuxRegexpFunction · 0.68
TestMuxRegexp2Function · 0.68
TestEscapedURLParamsFunction · 0.68