Skip to content

fix!: change credentials mode from "omit" to "same-origin" when set to false#27

Merged
lukas-reining merged 1 commit intomainfrom
fix/credentials-mode
Dec 15, 2024
Merged

fix!: change credentials mode from "omit" to "same-origin" when set to false#27
lukas-reining merged 1 commit intomainfrom
fix/credentials-mode

Conversation

@lukas-reining
Copy link
Owner

@lukas-reining lukas-reining commented Dec 15, 2024

Changes the default value of the credentials option in fetch.
Until now, it was set to omit if the withCredentials was falsy, as @oatkiller pointed out in #26.
As per the spec, this value should be same-site by default and include if the withCredentials option is set to true.

Reference: https://html.spec.whatwg.org/multipage/server-sent-events.html#dom-eventsource-withcredentials-dev

Caution

This is a breaking change, as users with withCredentials not set or set to false, will now send cookies to same-site instead of sending not them.
Be sure that this is acceptable for your use case.

Tip

If the credentials mode should still be set to omit, you can set the omitCredentials parameter to true.
If withCredentials is also set to true, omitCredentials will take precedence.

@lukas-reining lukas-reining force-pushed the fix/credentials-mode branch 2 times, most recently from c535058 to 3e87ce9 Compare December 15, 2024 12:54
… false

Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
@lukas-reining lukas-reining merged commit bf882f3 into main Dec 15, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant