diff --git a/.changeset/slimy-ducks-scream.md b/.changeset/slimy-ducks-scream.md new file mode 100644 index 00000000000..66187335a80 --- /dev/null +++ b/.changeset/slimy-ducks-scream.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +Update the `accept` header used with the `GraphQL17Alpha9Handler` to `multipart/mixed;incrementalSpec=v0.2` to ensure the newest incremental delivery format is requested. diff --git a/.size-limits.json b/.size-limits.json index e214463c49d..6671f69ef70 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,6 +1,6 @@ { - "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 44752, - "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 39500, - "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 33897, - "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27749 + "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 44831, + "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 39452, + "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 33875, + "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27756 } diff --git a/src/incremental/handlers/graphql17Alpha9.ts b/src/incremental/handlers/graphql17Alpha9.ts index 51ea4acc714..ee671c18504 100644 --- a/src/incremental/handlers/graphql17Alpha9.ts +++ b/src/incremental/handlers/graphql17Alpha9.ts @@ -259,7 +259,11 @@ export class GraphQL17Alpha9Handler if (hasDirectives(["defer", "stream"], request.query)) { const context = request.context ?? {}; const http = (context.http ??= {}); - http.accept = ["multipart/mixed", ...(http.accept || [])]; + // https://specs.apollo.dev/incremental/v0.2/ + http.accept = [ + "multipart/mixed;incrementalSpec=v0.2", + ...(http.accept || []), + ]; request.context = context; } diff --git a/src/link/http/__tests__/HttpLink.ts b/src/link/http/__tests__/HttpLink.ts index 69792fab1c3..53586aeb351 100644 --- a/src/link/http/__tests__/HttpLink.ts +++ b/src/link/http/__tests__/HttpLink.ts @@ -1636,7 +1636,7 @@ describe("HttpLink", () => { headers: { "content-type": "application/json", accept: - "multipart/mixed,application/graphql-response+json,application/json;q=0.9", + "multipart/mixed;incrementalSpec=v0.2,application/graphql-response+json,application/json;q=0.9", }, }) ); @@ -1744,7 +1744,7 @@ describe("HttpLink", () => { headers: { "content-type": "application/json", accept: - "multipart/mixed,application/graphql-response+json,application/json;q=0.9", + "multipart/mixed;incrementalSpec=v0.2,application/graphql-response+json,application/json;q=0.9", }, }) );