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

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
pre-commit-ci[bot] committed Sep 25, 2024
commit e98048a816df68ad74a6eb5a464befd649f459ad
4 changes: 3 additions & 1 deletion strawberry/http/async_base_view.py
Original file line number Diff line number Diff line change
@@ -186,7 +186,9 @@ async def run(
raise HTTPException(404, "Not Found")

if request_adapter.method == "GET" and not self.allow_queries_via_get:
raise HTTPException(HTTPStatus.METHOD_NOT_ALLOWED, HTTPStatus.METHOD_NOT_ALLOWED.phrase)
raise HTTPException(
HTTPStatus.METHOD_NOT_ALLOWED, HTTPStatus.METHOD_NOT_ALLOWED.phrase
)

sub_response = await self.get_sub_response(request)
context = (
4 changes: 3 additions & 1 deletion strawberry/http/sync_base_view.py
Original file line number Diff line number Diff line change
@@ -182,7 +182,9 @@ def run(
raise HTTPException(404, "Not Found")

if request_adapter.method == "GET" and not self.allow_queries_via_get:
raise HTTPException(HTTPStatus.METHOD_NOT_ALLOWED, HTTPStatus.METHOD_NOT_ALLOWED.phrase)
raise HTTPException(
HTTPStatus.METHOD_NOT_ALLOWED, HTTPStatus.METHOD_NOT_ALLOWED.phrase
)

sub_response = self.get_sub_response(request)
context = (