Skip to content
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

Allow setting withCredentials in spf xhr options #417

Merged
merged 1 commit into from
Sep 12, 2016

Conversation

zhaoz
Copy link
Contributor

@zhaoz zhaoz commented Jul 14, 2016

This allows SPF to be used with CORS + Cookies.

@nicksay
Copy link
Contributor

nicksay commented Jul 14, 2016

You're going to have to thread this to spf.nav.request.send as well. To make this available to clients, we could also thread this one step further to spf.nav.load. (Since withCredentials has no-effect on same-domain requests and we currently force reloads on cross-origin navigation, I don't think we need to make this available to spf.nav.navigate.)

@zhaoz
Copy link
Contributor Author

zhaoz commented Jul 17, 2016

Added commits to forward withCredentials to spf.nav.request.send and spf.nav.load, also added to the markdown file.

Let me know if you prefer to have this squashed into one commit.

@@ -219,6 +219,8 @@ to the callback will be an object that conforms to the
[spf.Event](#spf.event)).
`postData: ArrayBuffer | Blob | Document | FormData | null | string | undefined`
Optional data to send with the request. Only used if the method is "POST".
`withCredentials: boolean | undefined`
Optional flag to configure the XHR to send withCredentials or not.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should revert this file; it will be auto-generated from src/api.js with the next release and will use the description from the JsDoc.

@nicksay
Copy link
Contributor

nicksay commented Jul 18, 2016

Please do squash into a single commit. You either do it beforehand in your fork or "squash and merge" using the GitHub UI when merging the PR.

@zhaoz
Copy link
Contributor Author

zhaoz commented Jul 27, 2016

Squashed my commits and addressed comments. Not sure how to mark comments as addressed though.

@nicksay
Copy link
Contributor

nicksay commented Aug 12, 2016

Ah, sorry I forgot this before -- can you add the withCredentials property to the typedef in base.js too? https://github.com/youtube/spfjs/blob/master/src/client/base.js#L301

@zhaoz
Copy link
Contributor Author

zhaoz commented Aug 29, 2016

Updated

@@ -65,7 +65,8 @@ goog.require('spf.url');
* postData: spf.net.xhr.PostData,
* current: (string|null|undefined),
* referer: (string|null|undefined),
* type: (string|undefined)
* type: (string|undefined),
* withCredentials: (boolean|undefined)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a corresponding description to the comment above (line ~55).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@rviscomi
Copy link
Member

LGTM after nits.

 * forward withCerdentials in spf.nav.request.send
 * thread through nav.load
@zhaoz
Copy link
Contributor Author

zhaoz commented Aug 31, 2016

Addressed comment issue. And updated.

@nicksay nicksay merged commit eac1c97 into youtube:master Sep 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 participants