Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

feat($http): adds xhrFields to $http config object #7906

Closed
wants to merge 1 commit into from

Conversation

sjurba
Copy link
Contributor

@sjurba sjurba commented Jun 19, 2014

The xhrFields object is passed to the XMLHttpRequest constructor making it possible to set non-standard properties on the XMLHttpRequest object. It is also possible to set the object on $http.defaults to use it globally. With this functionality it is possible to set the mozSystem and mozAnon properties, which is required to use angular in a packaged Firefox OS app. See https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#XMLHttpRequest()

Closes #2318

The `xhrFields` object is passed to the XMLHttpRequest constructor making it possible to set non-standard properties on the XMLHttpRequest object. It is also possible to set the object on `$http.defaults` to use it globally. With this functionality it is possible to set the `mozSystem` and `mozAnon` properties, which is required to use angular in a packaged Firefox OS app. See https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#XMLHttpRequest()

Closes angular#2318
@caitp
Copy link
Contributor

caitp commented Jun 19, 2014

This is awfully similar to #7903

@sjurba
Copy link
Contributor Author

sjurba commented Jun 19, 2014

Yes, I started working on it yesterday and didn't see the duplicate before I pushed it.. Sorry about that.. Like I commented on #7903, I have named it xhrFields like jQuery, added support for setting it on $http.defaults. I also added some tests and updated the documentation.

@Narretz
Copy link
Contributor

Narretz commented Jul 11, 2014

Closing, because in #7903 it was decided that always having a config parameter in createXhr is a bad idea. New plan is to allow a custom createXhr function (+ a default option to set arbitrary options after the object is instantiated) PRs welcome!

@Narretz Narretz closed this Jul 11, 2014
@sjurba sjurba deleted the xhrFields branch July 11, 2014 20:20
@coolaj86
Copy link

I see tons of pull requests and and activity surrounding this issue, but where is the official patch and documentation?

Can we link to that here and in the dozen or so issues that reference this problem?

@Narretz
Copy link
Contributor

Narretz commented Sep 28, 2014

There hasn't been an official patch. See my comment above yours and the discussion in the issue.

@caitp
Copy link
Contributor

caitp commented Sep 28, 2014

Closing, because in #7903 it was decided that always having a config parameter in createXhr is a bad idea.

Where was that decided? I am not seeing it in that issue

@caitp
Copy link
Contributor

caitp commented Sep 28, 2014

I think we do want to let people customize how they construct their XHR fields, specifically to support B2G/Gaia --- I can't really think of any other reason why anyone would want to

@caitp
Copy link
Contributor

caitp commented Sep 28, 2014

However I do agree that xhrFields is probably not what we want to do, since it doesn't help B2G/Gaia anyways

@Narretz
Copy link
Contributor

Narretz commented Sep 28, 2014

@caitp Sorry, I meant passing the parameters to the xhr constructor is a bad idea (as is done in this PR)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mozSystem parameter for window.XMLHttpRequest on FirefoxOS
4 participants