Skip to content

Commit

Permalink
Change behavior of delegate callbacks during 204 (No Content) respons…
Browse files Browse the repository at this point in the history
…e. refs RestKit#633
  • Loading branch information
blakewatters committed Apr 4, 2012
1 parent 887b4a4 commit e79b79e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Code/ObjectMapping/RKObjectLoader.m
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,16 @@ - (BOOL)isResponseMappable {
[self didFailLoadWithError:self.response.failureError];
return NO;
} else if ([self.response isNoContent]) {
// The No Content (204) response will never have a message body or a MIME Type. Invoke the delegate with self
[self informDelegateOfObjectLoadWithResultDictionary:[NSDictionary dictionaryWithObject:self forKey:@""]];
// The No Content (204) response will never have a message body or a MIME Type.
id resultDictionary = nil;
if (self.targetObject) {
resultDictionary = [NSDictionary dictionaryWithObject:self.targetObject forKey:@""];
} else if (self.sourceObject) {
resultDictionary = [NSDictionary dictionaryWithObject:self.sourceObject forKey:@""];
} else {
resultDictionary = [NSDictionary dictionary];
}
[self informDelegateOfObjectLoadWithResultDictionary:resultDictionary];
return NO;
} else if (NO == [self canParseMIMEType:[self.response MIMEType]]) {
// We can't parse the response, it's unmappable regardless of the status code
Expand Down

0 comments on commit e79b79e

Please sign in to comment.