Open tysonstewart opened 10 years ago
This is because render uses the ResponseWriter that is injected into it's handler function.
render.Renderer could grab the ResponseWriter from the context right before it renders things, but that would require some changes and introduce some undesired behavior. I'm willing to explore the idea given that it doesn't break existing functionality
I discovered this while trying to implement a cache handler. We don't want to cache all of our requests, so we'd like to pass the cache handler to the router. In order to do this, however, Renderer has to be passed to every route as well and after the cache.
Example:
Is it necessary to capture the ResponseWriter? Is there a better way to do what I'm trying to do?