Venkat S. Rao
Venkat S. Rao

Reputation: 1110

RestKit Using the same RKResponseDescriptors for multiple urls

I have two endpoints that return an user object. Instead of creating two RKResponseDescriptors is there a path pattern format that allows both to be used together.

RKResponseDescriptor *userResponseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:userMapping
                                                                                            method:RKRequestMethodAny
                                                                                       pathPattern:@"users"
                                                                                           keyPath:nil
                                                                                       statusCodes:[NSIndexSet indexSetWithIndex:200]];

[objectManager addResponseDescriptor:userResponseDescriptor];

RKResponseDescriptor *userAuthResponseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:userMapping
                                                                                            method:RKRequestMethodAny
                                                                                       pathPattern:@"auth"
                                                                                           keyPath:nil
                                                                                       statusCodes:[NSIndexSet indexSetWithIndex:200]];

[objectManager addResponseDescriptor:userAuthResponseDescriptor];

Is there a way to combine them?

Upvotes: 1

Views: 234

Answers (1)

Wain
Wain

Reputation: 119031

Based on the path patterns you show in your code, no. There really isn't a lot of overhead to having 2 different response descriptors. They are separate responses. From a performance point of view you should not notice any difference.

Upvotes: 2

Related Questions