зеркало из https://github.com/github/AFNetworking.git
A GET request for file:///path/to/file URLs has a self.response that does not respond to allHeaderFields because it is an NSURLResponse not an NSHTTPURLResponse
This commit is contained in:
Родитель
215a32e23c
Коммит
a0cc020357
|
@ -165,7 +165,7 @@ static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL
|
|||
- (NSStringEncoding)responseStringEncoding {
|
||||
// When no explicit charset parameter is provided by the sender, media subtypes of the "text" type are defined to have a default charset value of "ISO-8859-1" when received via HTTP. Data in character sets other than "ISO-8859-1" or its subsets MUST be labeled with an appropriate charset value.
|
||||
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.4.1
|
||||
if (self.response && !self.response.textEncodingName && self.responseData) {
|
||||
if (self.response && !self.response.textEncodingName && self.responseData && [self.response respondsToSelector:@selector(allHeaderFields)]) {
|
||||
NSString *type = nil;
|
||||
AFGetMediaTypeAndSubtypeWithString([[self.response allHeaderFields] valueForKey:@"Content-Type"], &type, nil);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче