-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(core): Deprecate API class #4281
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
77a8a28
feat(core): Deprecate API class
AbhiPrasad 0672c71
Convert transports to use functions instead of API class
AbhiPrasad 3bd4301
fix tests
AbhiPrasad c1d6f8b
fix request tests
AbhiPrasad fed9ce6
pass down tunnel properly
AbhiPrasad f8754e1
eslint disable deprecation
AbhiPrasad 37e83a4
only check for tunnel once
AbhiPrasad 075075f
Merge branch 'master' into abhi-deprecate-api-class
AbhiPrasad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint-disable deprecation/deprecation */ | ||
import { Dsn } from '@sentry/utils'; | ||
|
||
import { API, getReportDialogEndpoint } from '../../src/api'; | ||
import { API, getReportDialogEndpoint, getRequestHeaders } from '../../src/api'; | ||
|
||
const ingestDsn = 'https://[email protected]:1234/subpath/123'; | ||
const dsnPublic = 'https://[email protected]:1234/subpath/123'; | ||
|
@@ -24,12 +25,12 @@ describe('API', () => { | |
}); | ||
|
||
test('getRequestHeaders', () => { | ||
expect(new API(dsnPublic).getRequestHeaders('a', '1.0')).toMatchObject({ | ||
expect(getRequestHeaders(new Dsn(dsnPublic), 'a', '1.0')).toMatchObject({ | ||
'Content-Type': 'application/json', | ||
'X-Sentry-Auth': expect.stringMatching(/^Sentry sentry_version=\d, sentry_client=a\/1\.0, sentry_key=abc$/), | ||
}); | ||
|
||
expect(new API(legacyDsn).getRequestHeaders('a', '1.0')).toMatchObject({ | ||
expect(getRequestHeaders(new Dsn(legacyDsn), 'a', '1.0')).toMatchObject({ | ||
'Content-Type': 'application/json', | ||
'X-Sentry-Auth': expect.stringMatching( | ||
/^Sentry sentry_version=\d, sentry_client=a\/1\.0, sentry_key=abc, sentry_secret=123$/, | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think this is okay but generally I think this design still makes it hard for us to make improvements later. Unfortunately the subclassing situation will always be bad for minification but quite user friendly for custom transports, so it might be acceptable to do it this way.
In Python as an example we push the original options in (there are no transport options) and the transports pull from there what they need. We should probably not change this right now, but longer term I think that might be preferable here as well.
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.
I completely agree - but we can revisit this when we examine transports more holistically later on. I kept this pattern primarily to minimize the diff and possibilities for breakage.
This is the direction we should head in, actually we might be able to pull it off before the major