Skip to content

Commit 072da24

Browse files
authored
Update accept header used with GraphQL17Alpha9Handler (#12973)
Updates the header based on changes in apollographql/apollo-server#8148
1 parent f8dab9d commit 072da24

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

.changeset/slimy-ducks-scream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@apollo/client": patch
3+
---
4+
5+
Update the `accept` header used with the `GraphQL17Alpha9Handler` to `multipart/mixed;incrementalSpec=v0.2` to ensure the newest incremental delivery format is requested.

.size-limits.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 44752,
3-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 39500,
4-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 33897,
5-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27749
2+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 44831,
3+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 39452,
4+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 33875,
5+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27756
66
}

src/incremental/handlers/graphql17Alpha9.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ export class GraphQL17Alpha9Handler
259259
if (hasDirectives(["defer", "stream"], request.query)) {
260260
const context = request.context ?? {};
261261
const http = (context.http ??= {});
262-
http.accept = ["multipart/mixed", ...(http.accept || [])];
262+
// https://specs.apollo.dev/incremental/v0.2/
263+
http.accept = [
264+
"multipart/mixed;incrementalSpec=v0.2",
265+
...(http.accept || []),
266+
];
263267

264268
request.context = context;
265269
}

src/link/http/__tests__/HttpLink.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ describe("HttpLink", () => {
16361636
headers: {
16371637
"content-type": "application/json",
16381638
accept:
1639-
"multipart/mixed,application/graphql-response+json,application/json;q=0.9",
1639+
"multipart/mixed;incrementalSpec=v0.2,application/graphql-response+json,application/json;q=0.9",
16401640
},
16411641
})
16421642
);
@@ -1744,7 +1744,7 @@ describe("HttpLink", () => {
17441744
headers: {
17451745
"content-type": "application/json",
17461746
accept:
1747-
"multipart/mixed,application/graphql-response+json,application/json;q=0.9",
1747+
"multipart/mixed;incrementalSpec=v0.2,application/graphql-response+json,application/json;q=0.9",
17481748
},
17491749
})
17501750
);

0 commit comments

Comments
 (0)