-
Notifications
You must be signed in to change notification settings - Fork 387
Conversation
93d1df0
to
5f63649
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few minor questions regarding constant definition.
JSON = 'application/json', // eslint-disable-line @shopify/typescript/prefer-pascal-case-enums | ||
GraphQL = 'application/graphql', // eslint-disable-line @shopify/typescript/prefer-pascal-case-enums | ||
URLEncoded = 'application/x-www-form-urlencoded', // eslint-disable-line @shopify/typescript/prefer-pascal-case-enums | ||
JSON = 'application/json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are they no Javascript constant we could use instead of defining them ourselves? I know it would not add much value but I am just cautious redefining things manually as it always open the door to a future mistake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately no, we use @shopify/network
for those shared constants. It has pre-defined values for the header names (which we use here), but not for the MIME types :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok I understand worth raising an issue there or even a PR no ? Or do you think thats not the right place for this sort of constant?
899747f
to
7a98b53
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! Thanks for adding this 🚀
WHY are these changes introduced?
The Storefront API has been updated to allow a few headers to improve how we track requests to it, and our client should start complying with it.
WHAT is this pull request doing?
Making the override method where we set the headers for the GraphQL client more generic, so that it takes any number of headers, and setting the new headers in the SF API client.
Type of change
Considering this a patch from the perspective of it being a fix for tracking, rather than adding new features for users of this library.
Checklist