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

feat($http): add overrideMimeType passthrough #7689

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feat($http): add overrideMimeType passthrough #7689

wants to merge 1 commit into from

Conversation

quietmint
Copy link

Call xhr.overrideMimeType() by defining config.overrideMimeType or $http.defaults.overrideMimeType

Closes #7669

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#7689)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@@ -627,6 +630,10 @@ function $HttpProvider() {
config.withCredentials = defaults.withCredentials;
}

if (isUndefined(config.overrideMimeType) && !isUndefined(defaults.overrideMimeType)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

whitespace issues here and above

@caitp
Copy link
Contributor

caitp commented Jun 4, 2014

I think this might be very useful after we change $http to not parse JSON unless the mime-type includes JSON, but I'm not sure there are too many other use cases for this, since I am fairly sure the browser only tries to parse documents or blobs or whatever if the responseType is set to some appropriate value

@caitp
Copy link
Contributor

caitp commented Jun 4, 2014

I could be wrong about that though, need to bug anne about that.

@quietmint
Copy link
Author

The main use case is correcting invalid character sets (e.g., East Asian languages incorrectly marked as ISO-8859-1) or allowing binary data to pass through unaltered (e.g., in browsers where XHR doesn't support the blob responseType).

@@ -1412,11 +1414,12 @@ describe('$http', function() {
});


it('should use withCredentials from default', function() {
it('should use withCredentials and overrideMimeType from default', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should be testing overrideMimeType in this spec, it should get its own spec, so that we can keep the scope of each spec very narrow

Copy link
Author

Choose a reason for hiding this comment

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

Why make this different than the immediately preceding spec for 'it should pass timeout, withCredentials, responseType, and overrideMimeType'?

@mary-poppins
Copy link

I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS.

Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match.

If you signed the CLA as a corporation, please let us know the company's name.

Thanks a bunch!

PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR.
PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

@quietmint quietmint added cla: no and removed cla: yes labels Jun 5, 2014
Call xhr.overrideMimeType() by defining config.overrideMimeType or $http.defaults.overrideMimeType

Closes #7669
@mary-poppins
Copy link

CLA signature verified! Thank you!

Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes).

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.

$http/$httpBackend support for overrideMimeType()
5 participants