-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
…d types; add custom headers for subscriptions
0f64b92
to
8095221
Compare
1d922d0
to
934d7d4
Compare
@@ -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. | |||
* |
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.
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(); |
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.
Added tests here
@@ -2894,7 +2933,53 @@ describe('generateClient', () => { | |||
} | |||
); | |||
|
|||
expect(normalizePostGraphqlCalls(spy)).toMatchSnapshot() | |||
expect(normalizePostGraphqlCalls(spy)).toMatchSnapshot(); |
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.
Added tests here
@@ -3313,6 +3398,50 @@ describe('generateClient', () => { | |||
}); | |||
}); | |||
|
|||
test('can subscribe to onCreate() - with a custom header function that accepts requestOptions', done => { |
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.
Added tests here
packages/api-graphql/__tests__/AWSAppSyncRealTimeProvider.test.ts
Outdated
Show resolved
Hide resolved
bbe159f
to
7d14675
Compare
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. |
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
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.