Response 200OK but code enters the failure block in restkit

44 Views Asked by At

I have connected Charles to check the response of the call. The response header return 200OK but even then the code enters the failure block. Does it have to do anything with the way mapping is defined or is it some other trivial issue?

NSString *reviewsRequest = [NSString stringWithFormat:@"reviews/%@", reviewerId];
[MTAuthHandler refreshTokenIfExpired:^(id result, NSError *error) {
    [MTRestkitManager instance].objectManager.requestSerializationMIMEType = RKMIMETypeJSON;

    [[MTRestkitManager instance].objectManager getObjectsAtPath:reviewsRequest parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
        NSLog(@"success");
        if (completion) {
            completion(YES, nil);
        }
    } failure:^(RKObjectRequestOperation *operation, NSError *error) {
        NSLog(@"failed");
        if (completion) {
            completion(NO, error);
        }
    }];
}];

The error message shows - NSLocalizedDescription=Expected status code in (400-499), got 200

Any pointers will be highly appreciated.

0

There are 0 best solutions below