Added withCredentials option.#36
Merged
developit merged 2 commits intodevelopit:masterfrom Jun 12, 2020
crissto:withCredentials
Merged
Added withCredentials option.#36developit merged 2 commits intodevelopit:masterfrom crissto:withCredentials
developit merged 2 commits intodevelopit:masterfrom
crissto:withCredentials
Conversation
Contributor
Author
|
As per #30. |
src/index.js
Outdated
| body: data, | ||
| headers: deepMerge(options.headers, customHeaders, true) | ||
| headers: deepMerge(options.headers, customHeaders, true), | ||
| credentials: options.withCredentials === true ? 'include' : 'same-origin' |
There was a problem hiding this comment.
As every byte matters, I'm suggesting a shorter solution:
credentials: options.withCredentials && 'include'If options.withCredentials is true it will assign 'include' otherwise, the default option will be chosen which is 'same-origin'.
Also if this suggestion is somehow incorrect, you can make it shorter by simply removing === true.
Contributor
Author
There was a problem hiding this comment.
Good point, I will update the PR. Thanks!
developit
approved these changes
Jun 12, 2020
Owner
|
Nice work! I need to set up mocking to test this. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Forward withCredentials options to set credentials to 'include'.
If no withCredentials options, credentials will be 'same-origin' by default.