BuildRiot
Sign in

Article · Frontend

GraphiQL 6 transport: Test gateway discovery and execution separately

GraphiQL 6’s createTransport discovers supported HTTP methods, but its discovery fallback does not retry failed operations. This guide tests its default behavior, covering gateway routing, CORS permissions, authentication and response handling.

A lamp-lit miniature gateway separates a green discovery indicator above from a paper request stalled at a closed response hatch below.
Illustration: BuildRiot (AI-generated)

Key takeaway

A gateway can advertise a method and still reject the operation that follows. Testing discovery and execution separately helps teams identify transport failures without relying on a retry that never happens.

An advertised method still needs an execution test

GraphiQL 6’s createTransport discovers supported HTTP methods, but it does not retry failed operations using another method, according to the migration guide. Trevor Scheer announced the release on November 7, 2026. Default createTransport discovery selects the new query method ahead of the post and get methods for queries. If a gateway advertises the preferred method and then rejects it, discovery fallback does not rescue the operation. This guide tests createTransport’s default behavior; custom transports control their own behavior. Sources: GraphQL, GraphQL on GitHub

Scheer’s announcement recommends the transport API as the replacement for fetcher, while retaining fetcher support. Transport metadata lets the response pane display the actual method, status, elapsed time and response size. RFC 10008, published in June 2026 as a Proposed Standard, defines the query method as safe and idempotent while allowing request content. Those semantics do not establish compatibility with a particular gateway. Treat adoption as a routing and response-handling change before considering performance or caching benefits. Sources: GraphQL, IETF

Establish a baseline before enabling discovery

Start in staging with a harmless named query. Use the same identity for direct-origin and gateway requests. Record timestamps, request IDs, method, status, response content type and whether execution reached the GraphQL service. Redact credentials in saved traces. For a controlled baseline, the migration guide shows the configuration below. Sources: GraphQL on GitHub

const transport = createTransport({
  url: 'https://api.example.com/graphql',
  supportedMethods: ['POST'],
});

Once the baseline works through both paths, introduce the migration guide’s default integration below. Discovery sends an options request and reads Allow. Queries prefer the query, post and then get methods, while mutations use post. Failed discovery or a timeout beyond two seconds makes createTransport assume only its initially configured method, normally post. Missing or malformed Allow produces the same fallback. Sources: GraphQL, GraphQL on GitHub

import { createTransport } from '@graphiql/toolkit';
import { GraphiQL } from 'graphiql';

const transport = createTransport({
  url: 'https://api.example.com/graphql',
});

export function Explorer() {
  return <GraphiQL transport={transport} />;
}

Separate discovery from browser preflight

An options request in a browser trace does not, by itself, identify transport discovery. Browser preflight also uses that method, with Access-Control-Request-Method and optionally Access-Control-Request-Headers. An application options request can itself require preflight, so inspect its headers and initiator. The table below separates cross-origin resource sharing, or CORS, controls from the capability information createTransport reads. Sources: GraphQL, WHATWG

Table

Headers governing discovery and browser access

HeaderPurposeAcceptance check
AllowAdvertises methods; does not grant CORS permissionCompare advertised methods with working routes
Access-Control-Allow-MethodsPermits methods through CORSCheck permission for the selected method
Access-Control-Allow-HeadersPermits request headers through CORSCheck explicit Authorization allowance
Access-Control-Expose-HeadersMakes response headers readable by JavaScriptCheck that scripts can read Allow
Check method discovery, browser permission and JavaScript visibility separately.Sources: GraphQL, WHATWG

Use the probes below to inspect discovery, simulated preflight and execution separately. Supply authentication through the deployment’s normal secure mechanism. The Accept value is a diagnostic choice, not GraphiQL’s documented generated header. Repeat the operation in GraphiQL from its actual browser origin to test the complete CORS exchange. Preflight excludes credentials and requires a successful status. Credentialed response sharing needs appropriate origin and credentials headers; a wildcard origin is unsuitable. Sources: WHATWG

API='https://api.example.com/graphql'
IDE_ORIGIN='https://ide.example.com'

# Application-level discovery
curl -i -X OPTIONS "$API" \
  -H "Origin: $IDE_ORIGIN"

# Simulated browser preflight for QUERY
curl -i -X OPTIONS "$API" \
  -H "Origin: $IDE_ORIGIN" \
  -H 'Access-Control-Request-Method: QUERY' \
  -H 'Access-Control-Request-Headers: authorization,content-type'

# Actual QUERY request
curl -i -X QUERY "$API" \
  -H "Origin: $IDE_ORIGIN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/graphql-response+json, application/json;q=0.9' \
  --data-binary '{"query":"query TransportProbe { __typename }","operationName":"TransportProbe"}'

Break discovery and execution independently

After successful execution works, inject failures at distinct points. First remove Allow or delay discovery beyond two seconds. Then observe whether execution uses the initially configured method as documented. Next advertise the query method but reject execution at the edge. The documented outcome is failure without another-method retry. The acceptance cases below test createTransport’s default discovery and execution behavior. Sources: GraphQL, GraphQL on GitHub

Table

Discovery and execution acceptance cases

Injected conditionDocumented behaviorEvidence to collect
Advertise query, post and getQueries prefer queryActual method and origin body
Advertise post and getQueries prefer postSelection through each gateway layer
Advertise get onlyQueries select get; mutations use postEncoded URL and mutation outcome
Remove AllowAssume initially configured methodDiscovery and subsequent operation
Delay discovery beyond two secondsAssume initially configured methodElapsed time and method selection
Advertise query, then reject executionNo retry using another methodVisible failure and request count
Compare observed behavior with the documented createTransport defaults.Sources: GraphQL, GraphQL on GitHub

Compare the query, operationName, variables and extensions received at the origin across methods. Include large variables, Unicode and multiple named operations. Inspect request bodies and URL parameters for differences. Accept-Query concerns query request content, whereas Accept negotiates response formats. If caching is enabled, test different bodies at the same URL and two authorized users for incorrect result reuse. Sources: IETF

Repeat the path with changing identities

Run valid, expired and absent credentials through each enabled method. Repeat for bearer tokens and cookies if both are supported. Check whether preflight encounters an authentication challenge, discovery receives the intended identity and execution enforces the same tenant restrictions. Authorization requires explicit permission in the CORS request-header allowance. Identify which exchange failed before changing authentication rules. Sources: WHATWG

createTransport discovers capabilities again when effective request headers change. Refresh a token and record the discovery count and resulting capabilities. Then start several operations together and record their discovery requests. Check whether gateway-generated discovery responses advertise methods that the authenticated upstream route cannot execute. For expired credentials, distinguish an authentication response from an HTML login page or an opaque browser failure. Do not broadly remove authentication from application discovery handling to repair a preflight problem. Sources: GraphQL on GitHub

Verify response negotiation before widening rollout

The GraphQL-over-HTTP draft requires clients to advertise application/graphql-response+json. Responses identify their media type through Content-Type. It warns that intermediaries can generate non-2xx responses, so generic JSON does not establish that a failure came from GraphQL. Capture GraphiQL’s actual Accept header for ordinary and incremental operations, then exercise the fixtures below. These are proposed acceptance tests, not measured gateway compatibility results. Check the deployment’s multipart parameters, quality weights and gateway behavior. Sources: GraphQL

  • Successful result: check that the media type and GraphQL result survive the gateway.
  • Syntax or validation error: distinguish the error body from gateway rejection.
  • Partial result: check that both data and errors reach the interface.
  • Gateway HTML or authentication rejection: check for a useful status and recognizable failure.
  • Unsupported request or response format: record the server’s rejection or negotiation policy.
  • Incremental response: verify that the first chunk arrives before completion.

For an unacceptable response preference, the draft recommends status 406 but permits the server to disregard Accept. Document the chosen policy. It currently recommends 294 Partial Success for responses containing both data and errors, including null data. The draft says 294 is not yet registered with the Internet Assigned Numbers Authority and calls for intermediary compatibility testing. Test the status the deployed server actually returns rather than assuming adoption of that recommendation. Sources: GraphQL

Keep browser developer tools open: TransportResponse exposes response headers and request byte counts. The standard interface lacks a response-details panel for those fields. Measure cold discovery, warm execution, changed authentication headers and delayed discovery separately. Record browser and gateway versions, network conditions, cache state, sample count, failures and 50th- and 95th-percentile latency. Compare complete click-to-result time with individual request timing. Expand the rollout only after advertised methods, identity checks and response fixtures pass through the actual browser-to-origin path. Sources: GraphQL on GitHub

Attribution

Sources

  1. 1GraphQLIntroducing GraphiQL 6Source published (UTC)
  2. 2GraphQL on GitHubGraphiQL 6 migration guide
  3. 3GraphQL on GitHubGraphiQL repository, including the toolkit changelog
  4. 4IETFRFC 10008: The HTTP QUERY Method
  5. 5WHATWGFetch Standard
  6. 6GraphQLGraphQL over HTTP draft

Read the original source for full details and context.

Report a problem

Links, dates or what you expected. Do not include passwords or private data.

More on Frontend

All Frontend stories

Review · Frontend

Review: MoonBit 1.0 release candidate, a language for WebAssembly and native apps

MoonBit released its 1.0 release candidate on November 26, 2026, freezing compiler changes to bug fixes until 1.0. Its primary targets are native code and WebAssembly, with JavaScript support for browsers and interfaces. The team targets February 18, 2027, for the full release with a stable core library. The async and archive packages may still receive minor API refinements. The moon fix command can apply compiler-suggested fixes.

MoonBit

GraphiQL 6 transport: Test gateway discovery and execution separately · BuildRiot