Open alexei opened 1 month ago
This pull request implements a fix to show a 404 error if a GET request is received when queries are not allowed. The changes are made in both the asynchronous and synchronous base view classes.
Change | Details | Files |
---|---|---|
Add a check for GET requests when queries are not allowed |
|
strawberry/http/async_base_view.py strawberry/http/sync_base_view.py |
sequenceDiagram
participant Client
participant BaseView
participant RequestAdapter
Client->>BaseView: Send request
BaseView->>RequestAdapter: Get request method
alt Request method is GET and queries via GET not allowed
BaseView-->>Client: Return 404 Not Found
else Request is valid
BaseView->>BaseView: Continue processing
end
Thanks for adding the RELEASE.md
file!
Here's a preview of the changelog:
This release fixes an issue where a GET request is processed despite it being disallowed.
Here's the tweet text:
🆕 Release (next) is out! Thanks to Alexandru Mărășteanu for the PR 👏
Get it here 👉 https://strawberry.rocks/release/(next)
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.75%. Comparing base (
18f0f5d
) to head (c1ac8c9
). Report is 5 commits behind head on main.
Comparing alexei:fix-skip_parsing_get
(c1ac8c9) with main
(8e92e2b)
✅ 15
untouched benchmarks
Description
When
allow_queries_via_get
isFalse
,GET
requests are processed despite the fact that queries are disallowed. Currently the response is "400: No GraphQL query found in the request" which is raised at a deeper level. I believe such requests should be rejected immediately as they needlessly consume resources.Types of Changes
Issues Fixed or Closed by This PR
*
Checklist
Summary by Sourcery
Fix the handling of GET requests by returning a 404 error when queries are disallowed, instead of processing them and returning a 400 error at a deeper level.
Bug Fixes: