Skip to content

Commit

Permalink
added conf method and defined initial test func
Browse files Browse the repository at this point in the history
  • Loading branch information
Corné de Jong authored and AlexVulaj committed Jun 19, 2024
1 parent 1a848bf commit fe14465
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,15 @@ func (r *Router) OmitRouteFromContext(value bool) *Router {
return r
}

// OmitRouterFromContext defines the behavior of omitting the Router from the
// http.Request context.
//
// RouterFromRequest will yield nil with this option.
func (r *Router) OmitRouterFromContext(value bool) *Router {
r.omitRouterFromContext = value
return r
}

// UseEncodedPath tells the router to match the encoded original path
// to the routes.
// For eg. "/path/foo%2Fbar/to" will match the path "/path/{var}/to".
Expand Down
4 changes: 4 additions & 0 deletions mux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,10 @@ func TestPanicOnCapturingGroups(t *testing.T) {
NewRouter().NewRoute().Path("/{type:(promo|special)}/{promoId}.json")
}

func TestRouterInContext(t *testing.T) {
// TODO Write tests for router in context
}

// ----------------------------------------------------------------------------
// Helpers
// ----------------------------------------------------------------------------
Expand Down

0 comments on commit fe14465

Please sign in to comment.