diff --git a/CHANGELOG.md b/CHANGELOG.md index eb0333a..2528aa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fixed #45: does not encode arrays correctly as HTTP GET parameter on Android - Fixed #54: requests are not responding on iOS with non-string values in header object +- Fixed #58: white-list of allowed content-types should be removed for iOS ## v1.9.0 diff --git a/src/ios/TextResponseSerializer.m b/src/ios/TextResponseSerializer.m index 0c80955..c9ef1d8 100644 --- a/src/ios/TextResponseSerializer.m +++ b/src/ios/TextResponseSerializer.m @@ -19,11 +19,12 @@ static BOOL AFErrorOrUnderlyingErrorHasCodeInDomain(NSError *error, NSInteger co - (instancetype)init { self = [super init]; + if (!self) { return nil; } - self.acceptableContentTypes = [NSSet setWithObjects:@"text/plain", @"text/html", @"text/json", @"application/hal+json", @"application/json", @"text/xml", @"application/xml", @"text/css", @"application/javascript", nil]; + self.acceptableContentTypes = nil; return self; } diff --git a/test/app-test-definitions.js b/test/app-test-definitions.js index 9265f14..de8c46e 100644 --- a/test/app-test-definitions.js +++ b/test/app-test-definitions.js @@ -302,6 +302,16 @@ const tests = [ result.type.should.be.equal('throwed'); result.message.should.be.equal('advanced-http: header values must be strings'); } + },{ + description: 'should accept content-type "application/xml" #58', + expected: 'resolved: {"status": 200, ...', + func: function(resolve, reject) { + cordova.plugin.http.get('http://httpbin.org/xml', {}, {}, resolve, reject); + }, + validationFunc: function(driver, result) { + result.type.should.be.equal('resolved'); + result.data.status.should.be.equal(200); + } } ];