mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-20 07:54:30 +08:00
Port commented out unit tests from 0.10.x to latest development sources to nail down issues with targetObject behaviors
This commit is contained in:
@@ -272,7 +272,7 @@ static NSString *RKStringDescribingURLResponseWithData(NSURLResponse *response,
|
||||
if (self.isCancelled) return;
|
||||
|
||||
// Map the response
|
||||
NSError *error;
|
||||
NSError *error = nil;
|
||||
RKMappingResult *mappingResult = [self performMappingOnResponse:&error];
|
||||
if (self.isCancelled) {
|
||||
return;
|
||||
|
||||
@@ -183,7 +183,9 @@ static dispatch_queue_t RKResponseMapperSerializationQueue() {
|
||||
if (self.targetObject) {
|
||||
self.mappingResult = [[RKMappingResult alloc] initWithDictionary:[NSDictionary dictionaryWithObject:self.targetObject forKey:[NSNull null]]];
|
||||
} else {
|
||||
self.mappingResult = [[RKMappingResult alloc] initWithDictionary:[NSDictionary dictionary]];
|
||||
// NOTE: For alignment with the behavior of loading an empty array or empty dictionary, if there is a nil targetObject we return a nil mappingResult.
|
||||
// This informs the caller that operation succeeded, but performed no mapping.
|
||||
self.mappingResult = nil;
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -230,6 +232,7 @@ static dispatch_queue_t RKResponseMapperSerializationQueue() {
|
||||
RKObjectMappingOperationDataSource *dataSource = [RKObjectMappingOperationDataSource new];
|
||||
self.mapperOperation = [[RKMapperOperation alloc] initWithObject:sourceObject mappingsDictionary:self.responseMappingsDictionary];
|
||||
self.mapperOperation.mappingOperationDataSource = dataSource;
|
||||
self.mapperOperation.targetObject = self.targetObject;
|
||||
[self.mapperOperation start];
|
||||
if (error) *error = self.mapperOperation.error;
|
||||
return self.mapperOperation.mappingResult;
|
||||
|
||||
Reference in New Issue
Block a user