Skip to content

fix: show 405 error if request is GET and queries are not allowed #3646

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions strawberry/http/async_base_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ async def run(
else:
raise HTTPException(404, "Not Found")

if request_adapter.method == "GET" and not self.allow_queries_via_get:
raise HTTPException(404, "Not Found")

sub_response = await self.get_sub_response(request)
context = (
await self.get_context(request, response=sub_response)
Expand Down
3 changes: 3 additions & 0 deletions strawberry/http/sync_base_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ def run(
else:
raise HTTPException(404, "Not Found")

if request_adapter.method == "GET" and not self.allow_queries_via_get:
raise HTTPException(404, "Not Found")

sub_response = self.get_sub_response(request)
context = (
self.get_context(request, response=sub_response)
Expand Down
Loading