-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat($http): add overrideMimeType passthrough #7689
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
@@ -627,6 +630,10 @@ function $HttpProvider() { | |||
config.withCredentials = defaults.withCredentials; | |||
} | |||
|
|||
if (isUndefined(config.overrideMimeType) && !isUndefined(defaults.overrideMimeType)) { |
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.
whitespace issues here and above
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 |
I could be wrong about that though, need to bug anne about that. |
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() { |
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.
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
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.
Why make this different than the immediately preceding spec for 'it should pass timeout, withCredentials, responseType, and overrideMimeType'
?
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. |
Call xhr.overrideMimeType() by defining config.overrideMimeType or $http.defaults.overrideMimeType Closes #7669
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). |
02dc2aa
to
fd2d6c0
Compare
cad9560
to
f294244
Compare
e8dc429
to
e83fab9
Compare
4dd5a20
to
998c61c
Compare
Call xhr.overrideMimeType() by defining config.overrideMimeType or $http.defaults.overrideMimeType
Closes #7669