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

Add Headers to GraphQL client response #1203

Merged
merged 5 commits into from
Jul 15, 2024

Conversation

lizkenyon
Copy link
Contributor

WHY are these changes introduced?

Fixes #637

When we migrated to the new clients we no longer returned the headers for successful responses.
Even if a request is successful developers may need to access the headers for debugging.

Type of change

  • Patch: Bug (non-breaking change which fixes an issue)
  • Minor: New feature (non-breaking change which adds functionality)
  • Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have used yarn changeset to create a draft changelog entry (do NOT update the CHANGELOG.md files manually)
  • I have added/updated tests for this change
  • I have documented new APIs/updated the documentation for modified APIs (for public APIs)

Developers need access to headers such as x-request-id to debug issues
@lizkenyon lizkenyon requested a review from a team as a code owner July 12, 2024 20:24
Copy link
Contributor

@paulomarg paulomarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, but if it's good LGTM.

export type GraphQLResponse<
Operation extends keyof Operations,
Operations extends AllOperations,
> = ResponseWithType<FetchResponseBody<ReturnData<Operation, Operations>>>;
> = ResponseWithType<FetchResponse<ReturnData<Operation, Operations>>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this return headers as an object or as a Headers type? In the remix package, we're returning a proper Response object, so the headers should be the fetch API ones too.

@lizkenyon lizkenyon force-pushed the liz/add-header-graphql-client-response branch from 16c79ed to a4fe44c Compare July 15, 2024 15:34
@lizkenyon lizkenyon force-pushed the liz/add-header-graphql-client-response branch from a4fe44c to 7e7b1e6 Compare July 15, 2024 16:00
@lizkenyon lizkenyon merged commit fc9f806 into main Jul 15, 2024
8 checks passed
@lizkenyon lizkenyon deleted the liz/add-header-graphql-client-response branch July 15, 2024 16:46
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

Successfully merging this pull request may close these issues.

Shopify headers stripped from Remix GraphQL client responses
3 participants