@ethlete/query 2.4.0 → 2.5.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.
@@ -613,7 +613,9 @@ const computeQueryBody = (config) => {
613
613
  if (config.method === 'GET' ||
614
614
  config.method === 'HEAD' ||
615
615
  config.method === 'OPTIONS' ||
616
- (isGqlQueryConfig(config.config) && config.config.transferVia === 'GET')) {
616
+ (isGqlQueryConfig(config.config) &&
617
+ (config.config.transferVia === 'GET' ||
618
+ (config.clientConfig.request?.gql?.transferVia === 'GET' && !config.config.transferVia)))) {
617
619
  return undefined;
618
620
  }
619
621
  if (isGqlQueryConfig(config.config)) {
@@ -647,7 +649,9 @@ const computeQueryHeaders = (config) => {
647
649
  return mergedHeaders;
648
650
  };
649
651
  const computeQueryQueryParams = (config) => {
650
- if (isGqlQueryConfig(config.config) && config.config.transferVia === 'GET') {
652
+ if (isGqlQueryConfig(config.config) &&
653
+ (config.config.transferVia === 'GET' ||
654
+ (config.clientConfig.request?.gql?.transferVia === 'GET' && !config.config.transferVia))) {
651
655
  const queryTemplate = config.config.query;
652
656
  const query = transformGql(queryTemplate);
653
657
  let params = query(config.args?.variables);
@@ -739,7 +743,12 @@ class Query {
739
743
  });
740
744
  this._updateUseResultInDependencies();
741
745
  const method = computeQueryMethod({ config: this._queryConfig });
742
- const body = computeQueryBody({ config: this._queryConfig, args: this._args, method });
746
+ const body = computeQueryBody({
747
+ config: this._queryConfig,
748
+ clientConfig: this._client.config,
749
+ args: this._args,
750
+ method,
751
+ });
743
752
  const headers = computeQueryHeaders({ client: this._client, config: this._queryConfig, args: this._args });
744
753
  request({
745
754
  urlWithParams: this._routeWithParams,
@@ -1720,7 +1729,7 @@ class QueryClient {
1720
1729
  base: this._clientConfig.baseRoute,
1721
1730
  route: queryConfig.route,
1722
1731
  pathParams: args?.pathParams,
1723
- queryParams: computeQueryQueryParams({ config: queryConfig, args }),
1732
+ queryParams: computeQueryQueryParams({ config: queryConfig, clientConfig: this._clientConfig, args }),
1724
1733
  });
1725
1734
  const cacheKey = isGqlQueryConfig(queryConfig) ? buildGqlCacheKey(queryConfig, args) : route;
1726
1735
  if (shouldCacheQuery(queryConfig.method)) {