Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.0
-
None
Description
It would be great to support headers for FileTransfer's iOS version (as done in Android: CB-78).
Right now, I had redefined CDVFileTranfer for our needs and added just after userAgent definition:
if(userAgent)
{ [req setValue: userAgent forHTTPHeaderField:@"User-Agent"]; }
NSMutableDictionary* headers = [params objectForKey:@"headers"];
NSEnumerator *enumerator = [headers keyEnumerator];
id key;
id val;
NSString *nkey;
while (nkey = [enumerator nextObject]) {
val = [headers objectForKey:nkey];
if(!val || val == [NSNull null])
// if it responds to stringValue selector (eg NSNumber) get the NSString
if ([val respondsToSelector:@selector(stringValue)])
// finally, check whether it is a NSString (for dataUsingEncoding selector below)
if (![val isKindOfClass:[NSString class]])
//if ([key respondsToSelector:@selector(stringValue)])
{ [req setValue:val forHTTPHeaderField:nkey]; //}
}
If you can include this code or similar one into future version of Cordova it will be awesome.
Thanks,