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 committed May 28, 2024
1 parent a698611 commit 5d9a7bc
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 @@ -284,6 +284,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 5d9a7bc

Please sign in to comment.