Skip to content

feat(http): add opt-in response negotiation - #2008

Open
simPod wants to merge 1 commit into
feat/http-execution-resultsfrom
feat/http-response-negotiation
Open

simPod wants to merge 1 commit into
feat/http-execution-resultsfrom
feat/http-response-negotiation

Conversation

@simPod

@simPod simPod commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

StandardServer always emits application/json and does not consider the client Accept header. The September 2026 GraphQL-over-HTTP specification defines a response media type and negotiation rules that require an explicit HTTP response path.

Add an opt-in graphqlOverHttp option rather than change existing behavior for current clients and framework integrations. Share response handling between PHP globals and PSR-7, respect media type priorities and wildcards, return 406 before execution when no representation is acceptable, and preserve existing Vary values. Keep request-specific response choices local to each operation, including promise-based execution.

Applications that build their own responses through executeRequest() or executePsrRequest() still own response negotiation and status codes.

Second in the HTTP stack, after #2007. This establishes the response layer used by the following status-mapping change. Negotiation does not inherently require the execution metadata, but status mapping needs both foundations. Strict request parsing follows separately; this PR alone does not provide complete protocol support.

Specification: https://http-spec.graphql.org/September2026/

Stack: #2007 → #2008 → #2009 → #2010.

Changelog

  • Add opt-in GraphQL-over-HTTP response media type negotiation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Accept-header parsing splits commas inside quoted parameter values, allowing requests that should receive 406 to execute operations instead.

1 open issue
What changed in this PR

Adds opt-in response negotiation to StandardServer, establishing the response layer for later GraphQL-over-HTTP status mapping while preserving legacy behavior.

Changes:

  • Adds the disabled-by-default graphqlOverHttp configuration option.
  • Shares response handling across PHP-global and PSR-7 entry points, including asynchronous execution, media type selection, early 406 responses, and Vary preservation.
  • Documents the option and adds negotiation and compatibility tests.
File Description
tests/​Server/​ServerConfigTest.php Verifies negotiation is disabled by default.
tests/​Server/​HttpServerTest.php Covers negotiation, legacy behavior, asynchronous responses, and early rejection.
src/​Server/​StandardServer.php Integrates opt-in negotiation into both HTTP response paths.
src/​Server/​ServerConfig.php Adds the configuration option and accessors.
src/​Server/​HttpResponse.php Emits negotiated responses through PHP globals or PSR-7.
src/​Server/​HttpHelper.php Selects response media types and constructs responses.
docs/​executing-queries.md Explains opt-in usage and caller responsibilities.
docs/​class-reference.md Documents the new configuration setter.

Review effort: Balanced

Comment thread src/Server/HttpHelper.php Resolved
@simPod
simPod force-pushed the feat/http-response-negotiation branch from 3213f63 to 84e3566 Compare November 14, 2026 21:02
@simPod
simPod requested a balanced review from Copilot November 14, 2026 21:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Charset negotiation fails to decode HTTP quoted-pairs, incorrectly rejecting valid equivalent charset values with a 406 response.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread src/Server/HttpHelper.php Resolved
@simPod
simPod force-pushed the feat/http-response-negotiation branch from 84e3566 to 22fd15c Compare November 15, 2026 07:54
@simPod
simPod requested a balanced review from Copilot November 15, 2026 07:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the opt-in response negotiation changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@simPod
simPod added this pull request to stack #2011 November 15, 2026 08:23
@simPod
simPod requested a review from spawnia November 15, 2026 08:24
@simPod
simPod marked this pull request as ready for review November 15, 2026 08:30
Add an explicit server option and shared response handling for PHP globals and PSR-7.
Keep legacy defaults unchanged while negotiating modern GraphQL response media types.
@simPod
simPod force-pushed the feat/http-response-negotiation branch from 22fd15c to b928394 Compare November 18, 2026 11:24
@simPod
simPod removed this pull request from stack #2011 November 18, 2026 11:26
@simPod
simPod added this pull request to stack #2016 November 18, 2026 11:27

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants