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): pass request options to custom header functions #12572

Merged
merged 61 commits into from
Dec 13, 2023

Conversation

david-mcafee
Copy link
Member

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

Description of changes

This PR updates the API GraphQL category, as well as the AWSAppSyncRealTimeProvider, to send request options to custom header functions, which will allow customers that use custom header functions to access request information to sign their requests cryptographically. Request options are available when 1) generating the API client, 2) executing individual model operations, and 3) when creating subscriptions.

Issue #, if available

Description of how you validated changes

  1. Manual testing
  2. Added unit tests

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.

@@ -66,23 +66,23 @@ function makeAppSyncStreams() {
* replaces fields that are likely to change between calls (or library version revs)
* with static values. When possible, on the unpredicable portions of these values
* are replaced.
*
Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like this file was previously updated without Prettier - I've added comments below to assist with identifying the added tests.

@@ -2795,7 +2795,46 @@ describe('generateClient', () => {
description: 'something something',
});

expect(normalizePostGraphqlCalls(spy)).toMatchSnapshot()
expect(normalizePostGraphqlCalls(spy)).toMatchSnapshot();
Copy link
Member Author

Choose a reason for hiding this comment

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

Added tests here

@@ -2894,7 +2933,53 @@ describe('generateClient', () => {
}
);

expect(normalizePostGraphqlCalls(spy)).toMatchSnapshot()
expect(normalizePostGraphqlCalls(spy)).toMatchSnapshot();
Copy link
Member Author

Choose a reason for hiding this comment

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

Added tests here

@@ -3313,6 +3398,50 @@ describe('generateClient', () => {
});
});

test('can subscribe to onCreate() - with a custom header function that accepts requestOptions', done => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Added tests here

@stocaaro
Copy link
Contributor

The change looks fine. For posterity's sake, can you add a description to this PR that captures what customer behavior is changing with this diff and confirm that you've tested the behavior in a sample app? Happy to approve this once the description is filled in a bit.

@david-mcafee
Copy link
Member Author

The change looks fine. For posterity's sake, can you add a description to this PR that captures what customer behavior is changing with this diff and confirm that you've tested the behavior in a sample app? Happy to approve this once the description is filled in a bit.

Good callout! This has been added.

@david-mcafee david-mcafee merged commit b092100 into main Dec 13, 2023
31 checks passed
@david-mcafee david-mcafee deleted the fn-headers-args branch December 13, 2023 18:07
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

3 participants