Adding early return for hasAcceptableContentType

This commit is contained in:
Mattt Thompson 2012-08-31 08:41:57 -07:00
parent cdbae5a9fb
commit e445903901

View file

@ -173,16 +173,19 @@ static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) {
}
- (BOOL)hasAcceptableStatusCode {
if(!self.response) {
// no response means network failure or such
if (!self.response) {
return NO;
}
NSUInteger statusCode = ([self.response isKindOfClass:[NSHTTPURLResponse class]]) ? (NSUInteger)[self.response statusCode] : 200;
return ![[self class] acceptableStatusCodes] || [[[self class] acceptableStatusCodes] containsIndex:statusCode];
}
- (BOOL)hasAcceptableContentType {
if (!self.response) {
return NO;
}
return ![[self class] acceptableContentTypes] || [[[self class] acceptableContentTypes] containsObject:[self.response MIMEType]];
}