Skip to content

Commit 64731a3

Browse files
author
Sefa Ilkimen
committed
fix silkimen#58: white-list of allowed content-types should be removed for iOS
1 parent 73097b9 commit 64731a3

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Fixed #45: does not encode arrays correctly as HTTP GET parameter on Android
66
- Fixed #54: requests are not responding on iOS with non-string values in header object
7+
- Fixed #58: white-list of allowed content-types should be removed for iOS
78

89
## v1.9.0
910

src/ios/TextResponseSerializer.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ + (instancetype)serializer {
1919

2020
- (instancetype)init {
2121
self = [super init];
22+
2223
if (!self) {
2324
return nil;
2425
}
2526

26-
self.acceptableContentTypes = [NSSet setWithObjects:@"text/plain", @"text/html", @"text/json", @"application/hal+json", @"application/json", @"text/xml", @"application/xml", @"text/css", @"application/javascript", nil];
27+
self.acceptableContentTypes = nil;
2728

2829
return self;
2930
}

test/app-test-definitions.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,16 @@ const tests = [
302302
result.type.should.be.equal('throwed');
303303
result.message.should.be.equal('advanced-http: header values must be strings');
304304
}
305+
},{
306+
description: 'should accept content-type "application/xml" #58',
307+
expected: 'resolved: {"status": 200, ...',
308+
func: function(resolve, reject) {
309+
cordova.plugin.http.get('http://httpbin.org/xml', {}, {}, resolve, reject);
310+
},
311+
validationFunc: function(driver, result) {
312+
result.type.should.be.equal('resolved');
313+
result.data.status.should.be.equal(200);
314+
}
305315
}
306316
];
307317

0 commit comments

Comments
 (0)