-
Notifications
You must be signed in to change notification settings - Fork 105
Adding support for setting the fetch API credentials mode #1317
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
Conversation
/** | ||
* A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. | ||
*/ | ||
credentials?: "include" | "omit" | "same-origin" | undefined | string; |
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.
Nit: maybe credentialsMode instead?
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.
credentials
matches the property on the Fetch request itself. I think it makes sense to keep this property name consistent with how it's used on the request.
@@ -77,6 +77,7 @@ export class FetchHttpHandler implements HttpHandler<FetchHttpHandlerConfig> { | |||
} | |||
const requestTimeoutInMs = this.config!.requestTimeout; | |||
const keepAlive = this.config!.keepAlive === true; | |||
const credentials = this.config!.credentials as RequestInit["credentials"]; |
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.
we're already using RequestInit
, so RequestCredentials
is probably globally available too, but I'm being conservative here.
Issue #, if available: 1296
Description of changes: Adds support to set credentials in the fetch API to
include
,same-origin
, oromit
.If one or more of the packages in the
/packages
directory has been modified, be sureyarn changeset add
has been run and its output hasbeen committed and included in this pull request. See CONTRIBUTING.md.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.