Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set header on graphQL for Retrieving Storefront API translations #125

Open
wire67 opened this issue Sep 25, 2021 · 1 comment
Open

Comments

@wire67
Copy link

wire67 commented Sep 25, 2021

Unable to set header on graphQL for Retrieving Storefront API translations

We can query the supported resources using the Accept-Language HTTP header, to return translated content to the Storefront API.

Reference:
https://shopify.dev/api/examples/i18n-app-translations#retrieving-storefront-api-translations

Issue:
I was unable to set the header. My attempt was the following:

      $opt = $options->getGuzzleOptions();
      $opt = array_merge_multi($opt, ['headers' => ['Accept-Language' => 'fr']]);
      $options->setGuzzleOptions($opt);

I can see the header is put into _conditional but it does not seem to be passed further.

the output is also not showing the header:

[headerNames:GuzzleHttp\Psr7\Response:private] => Array
  | (
  | [date] => Date
  | [content-type] => Content-Type
  | [transfer-encoding] => Transfer-Encoding
  | [connection] => Connection
  | [x-sorting-hat-podid] => X-Sorting-Hat-PodId
  | [x-sorting-hat-shopid] => X-Sorting-Hat-ShopId
  | [vary] => Vary
  | [referrer-policy] => Referrer-Policy
  | [x-frame-options] => X-Frame-Options
  | [x-shopid] => X-ShopId
  | [x-shardid] => X-ShardId
  | [x-stats-userid] => X-Stats-UserId
  | [x-stats-apiclientid] => X-Stats-ApiClientId
  | [x-stats-apipermissionid] => X-Stats-ApiPermissionId
  | [x-shopify-api-version] => X-Shopify-API-Version
  | [content-language] => Content-Language
  | [strict-transport-security] => Strict-Transport-Security
  | [x-shopify-stage] => X-Shopify-Stage
  | [content-security-policy] => Content-Security-Policy
  | [x-content-type-options] => X-Content-Type-Options
  | [x-download-options] => X-Download-Options
  | [x-permitted-cross-domain-policies] => X-Permitted-Cross-Domain-Policies
  | [x-xss-protection] => X-XSS-Protection
  | [x-dc] => X-Dc
  | [nel] => NEL
  | [report-to] => Report-To
  | [x-request-id] => X-Request-ID
  | [cf-cache-status] => CF-Cache-Status
  | [expect-ct] => Expect-CT
  | [server] => Server
  | [cf-ray] => CF-RAY
  | [alt-svc] => alt-svc
  | )
@ortegafernando
Copy link

Hi, any solution for this? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants