Closed empijei closed 3 years ago
Let me focus on the use cases first.
Tests: it would make it possible to test if a default configuration has successfully installed the right set of interceptors
I'd be in favor of testing behavior over implementation here.
Orchestrators: this would allow orchestrated plugins to be installed in separate moments and easily share some configuration
Could you come up with a concrete example here?
I'd be in favor of testing behavior over implementation here.
Makes sense, but it would make people re-test their interceptors to just test the code the installs them.
That said, nothing prevents people from wrapping a servemux config with one that keeps tabs on what was installed, so if people really need this feature for very advanced use cases they can implement it themselves (and we keep the framework simpler).
It would be useful to have helpers like
(*ServeMuxConfig).Has(Interceptor) bool
and(*ServeMuxConfig).Get(Interceptor) (Interceptor, bool)
.These would facilitate some use cases: