[Issue #505] Handling missing content type correctly
This commit is contained in:
parent
c5ac49e5f9
commit
c0d7e11449
1 changed files with 9 additions and 1 deletions
|
|
@ -186,7 +186,15 @@ static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ![[self class] acceptableContentTypes] || [[[self class] acceptableContentTypes] containsObject:[self.response MIMEType]];
|
// According to RFC 2616:
|
||||||
|
// Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource. If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream".
|
||||||
|
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html
|
||||||
|
NSString *contentType = [self.response MIMEType];
|
||||||
|
if (!contentType) {
|
||||||
|
contentType = @"application/octet-stream";
|
||||||
|
}
|
||||||
|
|
||||||
|
return ![[self class] acceptableContentTypes] || [[[self class] acceptableContentTypes] containsObject:contentType];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setSuccessCallbackQueue:(dispatch_queue_t)successCallbackQueue {
|
- (void)setSuccessCallbackQueue:(dispatch_queue_t)successCallbackQueue {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue