mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Added isHTML and isXHTML MIME type introspection methods
This commit is contained in:
@@ -211,6 +211,15 @@
|
||||
return ([[self allHeaderFields] objectForKey:@"Location"]);
|
||||
}
|
||||
|
||||
- (BOOL)isHTML {
|
||||
return [[self contentType] rangeOfString:@"text/html" options:NSCaseInsensitiveSearch|NSAnchoredSearch].length > 0 ||
|
||||
[self isXHTML];
|
||||
}
|
||||
|
||||
- (BOOL)isXHTML {
|
||||
return [[self contentType] rangeOfString:@"application/xhtml+xml" options:NSCaseInsensitiveSearch|NSAnchoredSearch].length > 0;
|
||||
}
|
||||
|
||||
- (BOOL)isXML {
|
||||
return [[self contentType] rangeOfString:@"application/xml" options:NSCaseInsensitiveSearch|NSAnchoredSearch].length > 0;
|
||||
}
|
||||
|
||||
@@ -174,6 +174,16 @@
|
||||
*/
|
||||
- (NSString*)location;
|
||||
|
||||
/**
|
||||
* True when the server turned an HTML response (MIME type is text/html)
|
||||
*/
|
||||
- (BOOL)isHTML;
|
||||
|
||||
/**
|
||||
* True when the server turned an XHTML response (MIME type is application/xhtml+xml)
|
||||
*/
|
||||
- (BOOL)isXHTML;
|
||||
|
||||
/**
|
||||
* True when the server turned an XML response (MIME type is application/xml)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user