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

Remove X-Requested-With #1

Merged
merged 1 commit into from
Jun 14, 2014
Merged

Remove X-Requested-With #1

merged 1 commit into from
Jun 14, 2014

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Jun 13, 2014

There is no API to “undo” setting request headers on XHR so it really should be up to the client to specify this (or any other) header.

There is no API to “undo” setting request headers on XHR so it really should be up to the client to specify this (or any other) header.
@akre54
Copy link
Owner

akre54 commented Jun 13, 2014

Cool. There seems to be good precedent here: angular/angular.js@3a75b11.

Do we not need to handle the cross-domain logic jQuery has to mess with?

@gaearon
Copy link
Contributor Author

gaearon commented Jun 13, 2014

In my opinion if someone deems it necessary, they will have no trouble adding it in options.
It is only useful if you check for its presence on server to guard against CSRF. I'm not sure if any popular web frameworks do this automatically (they may), and if you do this check on your own, you might as well specify the header when calling NativeAjax.

@gaearon
Copy link
Contributor Author

gaearon commented Jun 13, 2014

BTW thanks for the repo. I finally got around to dropping jQuery dependency in our codebase and thanks to Backbone.NativeView and Backbone.NativeAjax I actually made it through, in just one day. I tried to do this twice before but to gave up; these drop-in replacements saved much of the hassle.

@gaearon
Copy link
Contributor Author

gaearon commented Jun 13, 2014

Allowing to use a custom Deferred is also a classy touch.

@akre54
Copy link
Owner

akre54 commented Jun 14, 2014

Rails uses it for request.xhr?. I'd rather not break peoples' apps who are relying on this one line, but I think it should be fine in this case. I'll make sure to document it in the breaking changes.

angular/angular.js#1004
https://groups.google.com/forum/#!topic/angular/gLh3tBg5lhc

@akre54
Copy link
Owner

akre54 commented Jun 14, 2014

And thanks, glad you like it. The Deferred stuff is all Paul's doing, but there was a proposal to add Backbone.Deferred to Backbone proper a little while back in jashkenas/backbone#2489. Maybe it'll have some more support now that Promises have landed in browsers.

akre54 added a commit that referenced this pull request Jun 14, 2014
Remove X-Requested-With
@akre54 akre54 merged commit 5eaa437 into akre54:master Jun 14, 2014
@gaearon gaearon deleted the patch-1 branch June 14, 2014 17:57
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.

2 participants