Muxes are not composable
empijei opened this issue · 2 comments
empijei commented
A nice feature of http.Mux is that it can be used as a handler, so users can set up separate parts of an application on separate muxes that share a common configuration (e.g. a set of interceptors) and then install them on the root mux.
This is currently not possible with GSW, and we should seriously consider doing it.
kele commented
To clarify, you are not referring to the safehttp.ServeMux
being composable with http.Mux
, but with itself, i.e.:
var m1 safehttp.ServeMux
var m2 safehttp.ServeMux
var rootMux safehttp.ServeMux
// These two lines below would not compile.
rootMux.Handle(..., m1)
rootMux.Handle(..., m2)
Correct?
empijei commented
Correct.