Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Revert "Add storefront missing headers" #961

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changeset/beige-kids-build.md

This file was deleted.

2 changes: 1 addition & 1 deletion lib/clients/graphql/__tests__/storefront_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('Storefront GraphQL client', () => {
path: `/api/${shopify.config.apiVersion}/graphql.json`,
data: QUERY,
headers: {
[ShopifyHeader.StorefrontPrivateToken]: 'private_token',
[ShopifyHeader.StorefrontAccessToken]: 'private_token',
},
}).toMatchMadeHttpRequest();
});
Expand Down
15 changes: 6 additions & 9 deletions lib/clients/graphql/storefront_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,13 @@ export class StorefrontClient extends GraphqlClient {

protected getApiHeaders(): HeaderParams {
const sdkVariant = LIBRARY_NAME.toLowerCase().split(' ').join('-');
const privateToken =
this.storefrontClass().config.privateAppStorefrontAccessToken;
const tokenHeaderParam =
privateToken === undefined
? {[ShopifyHeader.StorefrontAccessToken]: this.storefrontAccessToken}
: ({
[ShopifyHeader.StorefrontPrivateToken]: privateToken,
} as HeaderParams);

return {
...tokenHeaderParam,
[ShopifyHeader.StorefrontAccessToken]: this.storefrontClass().config
.isCustomStoreApp
? this.storefrontClass().config.privateAppStorefrontAccessToken ||
this.storefrontAccessToken
: this.storefrontAccessToken,
[ShopifyHeader.StorefrontSDKVariant]: sdkVariant,
[ShopifyHeader.StorefrontSDKVersion]: SHOPIFY_API_LIBRARY_VERSION,
};
Expand Down
1 change: 0 additions & 1 deletion lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export enum ShopifyHeader {
Topic = 'X-Shopify-Topic',
WebhookId = 'X-Shopify-Webhook-Id',
StorefrontAccessToken = 'X-Shopify-Storefront-Access-Token',
StorefrontPrivateToken = 'Shopify-Storefront-Private-Token',
StorefrontSDKVariant = 'X-SDK-Variant',
StorefrontSDKVersion = 'X-SDK-Version',
}
Expand Down
Loading