Browse Source

docs: Remove stale text from comment. (#568)

Comment for CurrentRoute claimed that setting the KeepContext option would propagate
the Route even after the request. The KeepContext option is deprecated and has no effect.
pull/575/head
Eric Skoglund 6 years ago committed by GitHub
parent
commit
948bec34b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      mux.go

3
mux.go

@ -435,8 +435,7 @@ func Vars(r *http.Request) map[string]string { @@ -435,8 +435,7 @@ func Vars(r *http.Request) map[string]string {
// CurrentRoute returns the matched route for the current request, if any.
// This only works when called inside the handler of the matched route
// because the matched route is stored in the request context which is cleared
// after the handler returns, unless the KeepContext option is set on the
// Router.
// after the handler returns.
func CurrentRoute(r *http.Request) *Route {
if rv := r.Context().Value(routeKey); rv != nil {
return rv.(*Route)

Loading…
Cancel
Save