Skip to content

Commit

Permalink
fix: show 404 if request is GET and queries are not allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
alexei committed Sep 25, 2024
1 parent 18f0f5d commit 7da16a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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

0 comments on commit 7da16a4

Please sign in to comment.