Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused helpers and redundant overrides #3710

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions strawberry/fastapi/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
from strawberry.asgi import ASGIRequestAdapter, ASGIWebSocketAdapter
from strawberry.exceptions import InvalidCustomContext
from strawberry.fastapi.context import BaseContext, CustomContext
from strawberry.http import process_result
from strawberry.http.async_base_view import AsyncBaseHTTPView
from strawberry.http.exceptions import HTTPException
from strawberry.http.typevars import Context, RootValue
Expand All @@ -54,7 +53,6 @@
from strawberry.http import GraphQLHTTPResponse
from strawberry.http.ides import GraphQL_IDE
from strawberry.schema import BaseSchema
from strawberry.types import ExecutionResult


class GraphQLRouter(
Expand Down Expand Up @@ -268,11 +266,6 @@ async def websocket_endpoint( # pyright: ignore
async def render_graphql_ide(self, request: Request) -> HTMLResponse:
return HTMLResponse(self.graphql_ide_html)

async def process_result(
self, request: Request, result: ExecutionResult
) -> GraphQLHTTPResponse:
return process_result(result)

async def get_context(
self, request: Union[Request, WebSocket], response: Union[Response, WebSocket]
) -> Context: # pragma: no cover
Expand Down
20 changes: 1 addition & 19 deletions strawberry/http/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from __future__ import annotations

import json
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Dict, List, Mapping, Optional
from typing import TYPE_CHECKING, Any, Dict, List, Optional
from typing_extensions import Literal, TypedDict

if TYPE_CHECKING:
Expand Down Expand Up @@ -36,25 +35,8 @@ class GraphQLRequestData:
protocol: Literal["http", "multipart-subscription"] = "http"


def parse_query_params(params: Dict[str, str]) -> Dict[str, Any]:
if "variables" in params:
params["variables"] = json.loads(params["variables"])

return params


def parse_request_data(data: Mapping[str, Any]) -> GraphQLRequestData:
return GraphQLRequestData(
query=data.get("query"),
variables=data.get("variables"),
operation_name=data.get("operationName"),
)


__all__ = [
"GraphQLHTTPResponse",
"process_result",
"GraphQLRequestData",
"parse_query_params",
"parse_request_data",
]
Loading