response middleware override issue

#2 · open · 1 comments

View on GitHub ↗

mpandzo

Hi, Adding the response middleware the way you did stops others from modifying headers in their own code via the response middleware. Perhaps you could make use of PyDispatcher or Blinker or similar to allow a producer consumer relationship and allow joint use of the response middleware?

Comments

subokita

@subyraman Since I can't push my branch up to this repo, I will just show my changes in `__init__.py` Original: ``` @app.middleware('response') async def compress_response(request, response): return (await self._compress_response(request, response)) ``` Updated: ``` async def compress_response(request, response): return (await self._compress_response(request, response)) # Append the compress response to the end of # the list of response middlewares app.response_middleware.append( compress_response ) ``` The updated one pass all the tests, and works as expected on my application. Would you kindly update it? Else I will just fork it, and update on my own repo