mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-04-24 00:00:03 +08:00
- convert response header keys to lowercase (iOS only)
- updated change log - incremented version for release
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
- (void)setRequestHeaders:(NSDictionary*)headers forManager:(AFHTTPSessionManager*)manager;
|
||||
- (void)setResults:(NSMutableDictionary*)dictionary withTask:(NSURLSessionTask*)task;
|
||||
- (NSMutableDictionary*)copyHeaderFields:(NSDictionary*)headerFields;
|
||||
|
||||
@end
|
||||
|
||||
@@ -37,10 +38,22 @@
|
||||
if (task.response != nil) {
|
||||
NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;
|
||||
[dictionary setObject:[NSNumber numberWithInt:response.statusCode] forKey:@"status"];
|
||||
[dictionary setObject:response.allHeaderFields forKey:@"headers"];
|
||||
[dictionary setObject:[self copyHeaderFields:response.allHeaderFields] forKey:@"headers"];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSMutableDictionary*)copyHeaderFields:(NSDictionary *)headerFields {
|
||||
NSMutableDictionary *headerFieldsCopy = [[NSMutableDictionary alloc] initWithCapacity:headerFields.count];
|
||||
NSString *headerKeyCopy;
|
||||
|
||||
for (NSString *headerKey in headerFields.allKeys) {
|
||||
headerKeyCopy = [[headerKey mutableCopy] lowercaseString];
|
||||
[headerFieldsCopy setValue:[headerFields objectForKey:headerKey] forKey:headerKeyCopy];
|
||||
}
|
||||
|
||||
return headerFieldsCopy;
|
||||
}
|
||||
|
||||
- (void)enableSSLPinning:(CDVInvokedUrlCommand*)command {
|
||||
bool enable = [[command.arguments objectAtIndex:0] boolValue];
|
||||
if (enable) {
|
||||
|
||||
Reference in New Issue
Block a user