From 49352018ffdbdd06a40ba2f42c8f1ce06c9592ec Mon Sep 17 00:00:00 2001 From: Patrick Arminio Date: Fri, 26 Jan 2024 18:12:02 +0100 Subject: [PATCH] Remove subresponse --- docs/general/multipart-subscriptions.md | 1 + strawberry/aiohttp/views.py | 2 -- strawberry/asgi/__init__.py | 1 - strawberry/channels/handlers/http_handler.py | 1 - strawberry/django/views.py | 1 - strawberry/fastapi/router.py | 1 - strawberry/http/async_base_view.py | 3 +-- strawberry/litestar/controller.py | 1 - strawberry/quart/views.py | 1 - strawberry/sanic/views.py | 1 - 10 files changed, 2 insertions(+), 11 deletions(-) diff --git a/docs/general/multipart-subscriptions.md b/docs/general/multipart-subscriptions.md index ef7157432b..6da191ca72 100644 --- a/docs/general/multipart-subscriptions.md +++ b/docs/general/multipart-subscriptions.md @@ -19,6 +19,7 @@ libraries: - Litestar - FastAPI - AioHTTP +- Quart # Usage diff --git a/strawberry/aiohttp/views.py b/strawberry/aiohttp/views.py index 1bb239dee1..033586dae0 100644 --- a/strawberry/aiohttp/views.py +++ b/strawberry/aiohttp/views.py @@ -191,9 +191,7 @@ async def create_multipart_response( self, request: web.Request, stream: Callable[[], AsyncGenerator[str, None]], - sub_response: web.Response, ) -> web.StreamResponse: - # TODO: use sub response response = web.StreamResponse( status=200, headers={ diff --git a/strawberry/asgi/__init__.py b/strawberry/asgi/__init__.py index 5b2829e891..271f3b71a3 100644 --- a/strawberry/asgi/__init__.py +++ b/strawberry/asgi/__init__.py @@ -225,7 +225,6 @@ async def create_multipart_response( self, request: Request, stream: Callable[[], AsyncIterator[str]], - sub_response: Response, ) -> Response: return StreamingResponse( stream(), diff --git a/strawberry/channels/handlers/http_handler.py b/strawberry/channels/handlers/http_handler.py index 4d8fe0a01f..87309b9659 100644 --- a/strawberry/channels/handlers/http_handler.py +++ b/strawberry/channels/handlers/http_handler.py @@ -281,7 +281,6 @@ async def create_multipart_response( self, request: ChannelsRequest, stream: Callable[[], AsyncGenerator[str, None]], - sub_response: TemporalResponse, ) -> MultipartChannelsResponse: # TODO: sub response return MultipartChannelsResponse(stream=stream) diff --git a/strawberry/django/views.py b/strawberry/django/views.py index a3be96ec5f..22912db83b 100644 --- a/strawberry/django/views.py +++ b/strawberry/django/views.py @@ -189,7 +189,6 @@ async def create_multipart_response( self, request: HttpRequest, stream: Callable[[], AsyncIterator[Any]], - sub_response: HttpResponse, ) -> HttpResponseBase: return StreamingHttpResponse( streaming_content=stream(), diff --git a/strawberry/fastapi/router.py b/strawberry/fastapi/router.py index 08d2a019e0..85f6558585 100644 --- a/strawberry/fastapi/router.py +++ b/strawberry/fastapi/router.py @@ -329,7 +329,6 @@ async def create_multipart_response( self, request: Request, stream: Callable[[], AsyncIterator[str]], - sub_response: Response, ) -> Response: return StreamingResponse( stream(), diff --git a/strawberry/http/async_base_view.py b/strawberry/http/async_base_view.py index 658caba2e4..de9e8578c0 100644 --- a/strawberry/http/async_base_view.py +++ b/strawberry/http/async_base_view.py @@ -108,7 +108,6 @@ async def create_multipart_response( self, request: Request, stream: Callable[[], AsyncGenerator[str, None]], - sub_response: SubResponse, ) -> Response: raise ValueError("Multipart responses are not supported") @@ -213,7 +212,7 @@ async def run( if isinstance(result, SubscriptionExecutionResult): stream = self._get_stream(request, result) - return await self.create_multipart_response(request, stream, sub_response) + return await self.create_multipart_response(request, stream) response_data = await self.process_result(request=request, result=result) diff --git a/strawberry/litestar/controller.py b/strawberry/litestar/controller.py index b388086fc3..ea7937f25c 100644 --- a/strawberry/litestar/controller.py +++ b/strawberry/litestar/controller.py @@ -284,7 +284,6 @@ async def create_multipart_response( self, request: Request, stream: Callable[[], AsyncIterator[str]], - sub_response: Response, ) -> Response: return Stream( stream(), diff --git a/strawberry/quart/views.py b/strawberry/quart/views.py index 21cfe83ca4..c1601a6683 100644 --- a/strawberry/quart/views.py +++ b/strawberry/quart/views.py @@ -107,7 +107,6 @@ async def create_multipart_response( self, request: Request, stream: Callable[[], AsyncGenerator[str, None]], - sub_response: Response, ) -> Response: return ( stream(), diff --git a/strawberry/sanic/views.py b/strawberry/sanic/views.py index 69255acf68..f7f44cd7ce 100644 --- a/strawberry/sanic/views.py +++ b/strawberry/sanic/views.py @@ -189,7 +189,6 @@ async def create_multipart_response( self, request: Request, stream: Callable[[], AsyncGenerator[str, None]], - sub_response: TemporalResponse, ) -> HTTPResponse: response = await self.request.respond( content_type="multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json",