Skip to content

Commit fe14465

Browse files
Corné de JongAlexVulaj
authored andcommitted
added conf method and defined initial test func
1 parent 1a848bf commit fe14465

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

mux.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,15 @@ func (r *Router) OmitRouteFromContext(value bool) *Router {
286286
return r
287287
}
288288

289+
// OmitRouterFromContext defines the behavior of omitting the Router from the
290+
// http.Request context.
291+
//
292+
// RouterFromRequest will yield nil with this option.
293+
func (r *Router) OmitRouterFromContext(value bool) *Router {
294+
r.omitRouterFromContext = value
295+
return r
296+
}
297+
289298
// UseEncodedPath tells the router to match the encoded original path
290299
// to the routes.
291300
// For eg. "/path/foo%2Fbar/to" will match the path "/path/{var}/to".

mux_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,10 @@ func TestPanicOnCapturingGroups(t *testing.T) {
17681768
NewRouter().NewRoute().Path("/{type:(promo|special)}/{promoId}.json")
17691769
}
17701770

1771+
func TestRouterInContext(t *testing.T) {
1772+
// TODO Write tests for router in context
1773+
}
1774+
17711775
// ----------------------------------------------------------------------------
17721776
// Helpers
17731777
// ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)