Simplify chi.URLParam, call chi.URLParamFromCtx (#1168)

This way we avoid having two nearly identical implementations.
This commit is contained in:
James Raspass 2026-08-31 11:53:31 +01:00 committed by GitHub
parent 50ef4e4c31
commit ae6be74691
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,10 +9,7 @@ import (
// URLParam returns the url parameter from a http.Request object.
func URLParam(r *http.Request, key string) string {
if rctx := RouteContext(r.Context()); rctx != nil {
return rctx.URLParam(key)
}
return ""
return URLParamFromCtx(r.Context(), key)
}
// URLParamFromCtx returns the url parameter from a http.Request Context.