-
Notifications
You must be signed in to change notification settings - Fork 96
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
Add withCredentials option. Fix #29 #33
Conversation
if (options.cors) { | ||
xhr.withCredentials = true | ||
|
||
if ("withCredentials" in options) { |
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.
can we default it to true.
We can use if (options.withCredentials !== false) {
?
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.
Oh that would be bad actually. What we want is
if (options.cors && options.withCredentials !== false) {
Meaning opt into cors & opt out of withCredentials
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.
See browserify/http-browserify#47, which I mentioned in #29. The spec says withCredentials should default to false, so that's what people expect. Also, the wildcard is not allowed in Access-Control-Allow-Origin when it's set to true.
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.
The spec says withCredentials should default to false, so that's what people expect
The spec has an annoying default, xhr defaults to true because that's what you want. Also I don't think breaking back compat is a good idea. Note that it should still be optin by setting cors
to true, so it DOES default to false
Also, the wildcard is not allowed in Access-Control-Allow-Origin when it's set to true.
The wildcard was always a bad idea, no production service should be using it.
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.
Thanks, I wasn't aware of the best practice there, and I imagine I'm not the only one. Maybe worth a word in the README? Do you have any good resources around this issue to point at?
In the meantime I'll change it to default to true.
Add withCredentials option. Fix #29
Published v1.12.0 |
No description provided.