@graphql-tools/url-loader 7.5.2 → 7.5.3-alpha-6ff17de4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +8 -1
  2. package/index.mjs +8 -1
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -391,7 +391,14 @@ class UrlLoader {
391
391
  }
392
392
  }
393
393
  const headers = Object.assign({}, options === null || options === void 0 ? void 0 : options.headers, ((_a = request.extensions) === null || _a === void 0 ? void 0 : _a.headers) || {});
394
- const accept = 'application/json, multipart/mixed, text/event-stream';
394
+ const acceptedProtocols = [`application/json`];
395
+ if (method === 'GET' && (options === null || options === void 0 ? void 0 : options.subscriptionsProtocol) === exports.SubscriptionProtocol.SSE) {
396
+ acceptedProtocols.push('text/event-stream');
397
+ }
398
+ if (method === 'POST') {
399
+ acceptedProtocols.push('multipart/mixed');
400
+ }
401
+ const accept = acceptedProtocols.join(', ');
395
402
  const query = graphql.print(request.document);
396
403
  const requestBody = {
397
404
  query,
package/index.mjs CHANGED
@@ -367,7 +367,14 @@ class UrlLoader {
367
367
  }
368
368
  }
369
369
  const headers = Object.assign({}, options === null || options === void 0 ? void 0 : options.headers, ((_a = request.extensions) === null || _a === void 0 ? void 0 : _a.headers) || {});
370
- const accept = 'application/json, multipart/mixed, text/event-stream';
370
+ const acceptedProtocols = [`application/json`];
371
+ if (method === 'GET' && (options === null || options === void 0 ? void 0 : options.subscriptionsProtocol) === SubscriptionProtocol.SSE) {
372
+ acceptedProtocols.push('text/event-stream');
373
+ }
374
+ if (method === 'POST') {
375
+ acceptedProtocols.push('multipart/mixed');
376
+ }
377
+ const accept = acceptedProtocols.join(', ');
371
378
  const query = print(request.document);
372
379
  const requestBody = {
373
380
  query,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/url-loader",
3
- "version": "7.5.2",
3
+ "version": "7.5.3-alpha-6ff17de4.0",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -13,7 +13,7 @@
13
13
  "@n1ru4l/graphql-live-query": "0.9.0",
14
14
  "@types/websocket": "1.0.4",
15
15
  "@types/ws": "^8.0.0",
16
- "cross-undici-fetch": "^0.0.20",
16
+ "cross-undici-fetch": "^0.0.26",
17
17
  "dset": "^3.1.0",
18
18
  "extract-files": "11.0.0",
19
19
  "graphql-sse": "^1.0.1",