Skip to content

Discover and automatically select transport methods - #4665

Merged
trevor-scheer merged 9 commits into
graphiql-6from
trevor/transport-method-discovery
Oct 23, 2026
Merged

trevor-scheer merged 9 commits into
graphiql-6from
trevor/transport-method-discovery

Conversation

@trevor-scheer

@trevor-scheer trevor-scheer commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

createTransport defaults to POST and requires callers to enumerate other supported methods. The toolbar's method selector also implies that its selection controls mutations, even though safe methods cannot carry them. RFC 10008 describes discovering method support through OPTIONS and Allow.

When supportedMethods is omitted, the transport discovers capabilities before its first HTTP operation using the effective headers. Concurrent operations share discovery, header changes trigger it again, and a two-second timeout or unavailable discovery falls back to POST (or the configured method). Explicit supportedMethods bypasses discovery. A valid advertisement with no usable methods prevents execution. This discovers methods only, without Accept-Query format negotiation or automatic retries.

Queries automatically prefer QUERY, then POST, then GET. Mutations and operations whose type cannot be determined require POST. method: 'GET' or transport.setMethod?.('GET') overrides queries for testing; unavailable overrides reject queries without silently choosing another method. Calling setMethod() restores automatic selection. For GET queries and POST mutations without discovery, configure method: 'GET', supportedMethods: ['GET', 'POST']. GET encodes the operation and variables in the URL without a body. Request selection is captured per send, and cancellation doesn't abort another operation's shared discovery.

The top bar's chip and switcher are removed. Each HTTP response carries an optional TransportResponse.method, which the response pane shows beside status, timing, and size, including for error responses and incremental chunks. GraphiQL delegates routing to the transport and displays response metadata directly, without capability subscriptions or duplicate selection state. Socket events and custom transports that cannot report a method omit it. Custom transports remain responsible for mutation safety.

The RC-only changeset explains the change from earlier RCs. The consolidated transport-api.md entry describes the final API, and #4598 removes the standalone note after this RC publishes.

@changeset-bot

changeset-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8a25f9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@graphiql/toolkit Minor
@graphiql/react Minor
graphiql Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@trevor-scheer trevor-scheer changed the title Discover transport methods through OPTIONS Discover and automatically select transport methods Oct 23, 2026
@trevor-scheer
trevor-scheer marked this pull request as ready for review October 23, 2026 11:35
@trevor-scheer
trevor-scheer merged commit c4a62af into graphiql-6 Oct 23, 2026
14 checks passed
@trevor-scheer
trevor-scheer deleted the trevor/transport-method-discovery branch October 23, 2026 11:35
@github-actions github-actions Bot mentioned this pull request Oct 23, 2026
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.

1 participant