From 8ab462713007c8be5b7b424d9e6b477013a24085 Mon Sep 17 00:00:00 2001 From: Jonathan Ehwald Date: Fri, 11 Oct 2024 00:51:41 +0200 Subject: [PATCH] Use explicit response code to avoid type error --- RELEASE.md | 3 +++ strawberry/flask/views.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000000..6902fd7d51 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,3 @@ +Release type: patch + +This release tweaks the Flask integration's `render_graphql_ide` method to be stricter typed internally, making type checkers ever so slightly happier. diff --git a/strawberry/flask/views.py b/strawberry/flask/views.py index 053003ac91..d93f480b1e 100644 --- a/strawberry/flask/views.py +++ b/strawberry/flask/views.py @@ -187,7 +187,8 @@ async def dispatch_request(self) -> ResponseReturnValue: # type: ignore ) async def render_graphql_ide(self, request: Request) -> Response: - return render_template_string(self.graphql_ide_html) # type: ignore + content = render_template_string(self.graphql_ide_html) + return Response(content, status=200, content_type="text/html") def is_websocket_request(self, request: Request) -> TypeGuard[Request]: return False