RestKit: How to handle an empty response.body?

I request something with POST, and the server just sends a 200 status code with a content length of 0 back. How can I handle this? I am not allowed to add RKResponseDescriptor without display, and also not add RKResponseDescriptor.

+3
source share
1 answer

And, I just found out, you can create a mapping for the NSNull class. It seems to work. Here is the code:

    {
        RKObjectMapping* responseMapping = [RKObjectMapping mappingForClass:[NSNull class]];
        RKResponseDescriptor* response =
        [RKResponseDescriptor responseDescriptorWithMapping:responseMapping
                                                     method:RKRequestMethodAny
                                                pathPattern:@"entry/sync"
                                                    keyPath:nil
                                                statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

        [restObjectManager addResponseDescriptor:response];
    }

Please tell me if this is correct.

+10
source

All Articles