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

feat(data): add custom header support to data schema client #12559

Merged
merged 33 commits into from
Nov 15, 2023
Merged

Conversation

david-mcafee
Copy link
Member

@david-mcafee david-mcafee commented Nov 10, 2023

Description of changes

Custom headers can now be supplied to both the generated client, as well as to individual model operations (including subscriptions). Includes improved type updates to existing headers, and better documentation around the usage of existing custom headers.

Issue #, if available

Description of how you validated changes

  • Unit tests
  • Manual testing

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@david-mcafee david-mcafee marked this pull request as ready for review November 10, 2023 23:26
@david-mcafee david-mcafee requested a review from a team as a code owner November 10, 2023 23:26
@david-mcafee david-mcafee changed the title feat(data): add types for custom headers feat(data): add custom header support to data schema client Nov 10, 2023
@david-mcafee
Copy link
Member Author

Addressing merge conflicts now

@david-mcafee
Copy link
Member Author

Merge conflicts resolved

iartemiev
iartemiev previously approved these changes Nov 11, 2023
Copy link
Contributor

@svidgen svidgen left a comment

Choose a reason for hiding this comment

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

CustomerHeaders can also be an async () => Promise<Headers>. Can we see a couple tests using that form?

@david-mcafee
Copy link
Member Author

CustomerHeaders can also be an async () => Promise<Headers>. Can we see a couple tests using that form?

Good callout! Will add these

@david-mcafee david-mcafee requested a review from a team as a code owner November 11, 2023 06:22
@david-mcafee
Copy link
Member Author

CustomerHeaders can also be an async () => Promise<Headers>. Can we see a couple tests using that form?

Good callout! Will add these

These have been added.

iartemiev
iartemiev previously approved these changes Nov 14, 2023
if (authToken) {
headers.Authorization = authToken;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

This has been moved to _graphql and the AWSAppSyncRealTimeProvider so that we can add this to both static and functional header output.

@david-mcafee david-mcafee force-pushed the tb-headers branch 4 times, most recently from 35957bc to 6378ca6 Compare November 15, 2023 17:44
additionalHeaders: expect.objectContaining({
Authorization: 'some-token',
}),
authToken: 'some-token',
Copy link
Member Author

Choose a reason for hiding this comment

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

This will still be included in the header as it was previously, but not at this call-site (i.e. this will happen later).

additionalHeaders: expect.objectContaining({
Authorization: 'some-token',
}),
authToken: 'some-token',
Copy link
Member Author

Choose a reason for hiding this comment

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

This will still be included in the header as it was previously, but not at this call-site (i.e. this will happen later).

@david-mcafee david-mcafee merged commit 2b1db67 into main Nov 15, 2023
30 checks passed
@david-mcafee david-mcafee deleted the tb-headers branch November 15, 2023 18:15
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.

None yet

4 participants