Add extensions support to GraphQLRequest#591
Merged
leszekhanusz merged 12 commits intographql-python:masterfrom Apr 24, 2026
Merged
Add extensions support to GraphQLRequest#591leszekhanusz merged 12 commits intographql-python:masterfrom
leszekhanusz merged 12 commits intographql-python:masterfrom
Conversation
Support the `extensions` field on GraphQL requests, as defined in the GraphQL over HTTP spec. This allows passing protocol extensions (e.g. persisted query IDs) as a top-level key in the request payload. Closes graphql-python#590 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #591 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 38 40 +2
Lines 2908 3321 +413
==========================================
+ Hits 2908 3321 +413 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Verify that extensions set on GraphQLRequest are sent in the HTTP request body for aiohttp, httpx, and requests transports. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cover extensions across all transports and operation types: - aiohttp subscribe (HTTP + websocket) - aiohttp, httpx, and requests execute_batch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Merge 6 unit tests into one test_graphql_request_extensions - Merge aiohttp execute + subscribe into one test - Drop redundant httpx sync batch test (same code path as async) - Tighten assertions and remove unnecessary comments - Parse WS logged message as JSON instead of fragile string matching Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
@leszekhanusz what do you think about this approach vs a new argument to (extra_args seems to be something intended to be passed directly to the transport though, so that's probably not a good fit) |
Collaborator
|
Looks good to me! Much better than having to add an extensions attribute to ALL the execute and subscribe methods. |
leszekhanusz
approved these changes
Apr 24, 2026
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional
extensionsparameter toGraphQLRequest, as defined in the GraphQL over HTTP spec. When set, it is included as a top-level key in the request payload alongsidequery,variables, andoperationName.No transport changes needed — all transports already serialize
request.payload.Closes #590
Test plan