Skip to content

Commit

Permalink
Merge branch 'master' of github.com:twotoasters/RestKit into new-example
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel committed Jan 21, 2011
2 parents 52cea23 + d3a1059 commit 20747ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
10 changes: 5 additions & 5 deletions Code/Network/RKClient.h
Expand Up @@ -189,29 +189,29 @@ NSString* RKMakePathWithObject(NSString* path, id object);
/**
* Fetch a resource via an HTTP GET
*/
- (RKRequest*)get:(NSString*)resourcePath delegate:(id)delegate;
- (RKRequest*)get:(NSString*)resourcePath delegate:(NSObject<RKRequestDelegate>*)delegate;

/**
* Fetch a resource via an HTTP GET with a dictionary of params
*
* Note that this request _only_ allows NSDictionary objects as the params. The dictionary will be coerced into a URL encoded
* string and then appended to the resourcePath as the query string of the request.
*/
- (RKRequest*)get:(NSString*)resourcePath queryParams:(NSDictionary*)queryParams delegate:(id)delegate;
- (RKRequest*)get:(NSString*)resourcePath queryParams:(NSDictionary*)queryParams delegate:(NSObject<RKRequestDelegate>*)delegate;

/**
* Create a resource via an HTTP POST with a set of form parameters
*/
- (RKRequest*)post:(NSString*)resourcePath params:(NSObject<RKRequestSerializable>*)params delegate:(id)delegate;
- (RKRequest*)post:(NSString*)resourcePath params:(NSObject<RKRequestSerializable>*)params delegate:(NSObject<RKRequestDelegate>*)delegate;

/**
* Update a resource via an HTTP PUT
*/
- (RKRequest*)put:(NSString*)resourcePath params:(NSObject<RKRequestSerializable>*)params delegate:(id)delegate;
- (RKRequest*)put:(NSString*)resourcePath params:(NSObject<RKRequestSerializable>*)params delegate:(NSObject<RKRequestDelegate>*)delegate;

/**
* Destroy a resource via an HTTP DELETE
*/
- (RKRequest*)delete:(NSString*)resourcePath delegate:(id)delegate;
- (RKRequest*)delete:(NSString*)resourcePath delegate:(NSObject<RKRequestDelegate>*)delegate;

@end
14 changes: 9 additions & 5 deletions Code/Network/RKResponse.m
Expand Up @@ -231,20 +231,24 @@ - (NSString*)location {
}

- (BOOL)isHTML {
return [[self contentType] rangeOfString:@"text/html" options:NSCaseInsensitiveSearch|NSAnchoredSearch].length > 0 ||
[self isXHTML];
NSString* contentType = [self contentType];
return contentType && ([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;
NSString* contentType = [self contentType];
return contentType && [contentType rangeOfString:@"application/xhtml+xml" options:NSCaseInsensitiveSearch|NSAnchoredSearch].length > 0;
}

- (BOOL)isXML {
return [[self contentType] rangeOfString:@"application/xml" options:NSCaseInsensitiveSearch|NSAnchoredSearch].length > 0;
NSString* contentType = [self contentType];
return contentType && [contentType rangeOfString:@"application/xml" options:NSCaseInsensitiveSearch|NSAnchoredSearch].length > 0;
}

- (BOOL)isJSON {
return [[self contentType] rangeOfString:@"application/json" options:NSCaseInsensitiveSearch|NSAnchoredSearch].length > 0;
NSString* contentType = [self contentType];
return contentType && [contentType rangeOfString:@"application/json" options:NSCaseInsensitiveSearch|NSAnchoredSearch].length > 0;
}

@end

0 comments on commit 20747ff

Please sign in to comment.