diff --git a/sanic/utils.py b/sanic/utils.py index 47214872..1eaa0493 100644 --- a/sanic/utils.py +++ b/sanic/utils.py @@ -22,9 +22,9 @@ def sanic_endpoint_test(app, method='get', uri='/', gather_request=True, exceptions = [] if gather_request: - @app.middleware def _collect_request(request): results.append(request) + app.request_middleware.appendleft(_collect_request) async def _collect_response(sanic, loop): try: