-
Notifications
You must be signed in to change notification settings - Fork 265
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
chore: Use fetch as default for browsers instead of reqwest #199
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a458ce2
chore: Use fetch as default for browsers instead of reqwest
manueltanzi-okta 47be450
Convert tests to use fetch instead of jquery
manueltanzi-okta 4255960
Addressing comments
manueltanzi-okta b5e3dc0
Addressing comments
manueltanzi-okta 2b4335d
Fixing lint errors
manueltanzi-okta 0a30517
Addressing comments
manueltanzi-okta 798a526
Addressing comments
manueltanzi-okta 1c52ad5
Merge branch 'master' into manueltanzi-use-fetch-in-browser
manueltanzi-okta 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var packageJson = require('./package.json'); | ||
var OktaAuth = '<rootDir>/' + packageJson.browser; | ||
|
||
module.exports = { | ||
'coverageDirectory': './build2/reports/coverage', | ||
'restoreMocks': true, | ||
'moduleNameMapper': { | ||
'^OktaAuth(.*)$': OktaAuth | ||
}, | ||
'testMatch': [ | ||
'**/test/spec/*.js' | ||
], | ||
'testPathIgnorePatterns': [ | ||
'./test/spec/serverStorage.js' | ||
], | ||
'reporters': [ | ||
'default', | ||
'jest-junit' | ||
] | ||
}; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var packageJson = require('./package.json'); | ||
var OktaAuth = '<rootDir>/' + packageJson.main; | ||
|
||
module.exports = { | ||
'coverageDirectory': './build2/reports/coverage', | ||
'restoreMocks': true, | ||
'moduleNameMapper': { | ||
'^OktaAuth(.*)$': OktaAuth | ||
}, | ||
'testMatch': [ | ||
'**/test/spec/*.js' | ||
], | ||
'testPathIgnorePatterns': [ | ||
'./test/spec/fingerprint.js', | ||
'./test/spec/general.js', | ||
'./test/spec/oauthUtil.js', | ||
'./test/spec/token.js', | ||
'./test/spec/tokenManager.js', | ||
'./test/spec/webfinger.js' | ||
], | ||
'reporters': [ | ||
'default', | ||
'jest-junit' | ||
] | ||
}; |
This file was deleted.
Oops, something went wrong.
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
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
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.
Corrected, should be
Content-Type
in response.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.
🤦♂️
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.
Double checking - now that we're using cross-fetch in our tests, are we able to catch this error?
Also, did notice that we're not mocking out the
response.text()
function here - do we need to? In general, when will be have a response that's not application/json?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.
Yes, now we are able to catch that!
fyi,
response.text()
was working properly anyway for our flow, since we always do aJSON.parse
in http https://github.com/okta/okta-auth-js/blob/master/lib/http.js#L60, this is why I haven't notice that during manual testing.For what I have seen all our response should be application/json, so maybe should I remove the if/else?
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.
Seems reasonable if we're catching it downstream. Would also be curious why we have that code to handle it in the first place - my hunch is that at some point we'd occasionally return an error that was not a json response. This might be fixed now though.