i want to send an If-Modified-Since http header with a GET request, issued by [RKObjectManager getObjectsAtPath:...].
the migration guide tells that i can set only “global” default request headers for an RKObjectManager instance:
RKObjectManager* objectManager = [RKObjectManager managerWithBaseURLString:url];
[objectManager.HTTPClient setDefaultHeader:@"If-Modified-Since" value:@"Sat, 29 Dec 2012 19:43:31 GMT"];
since i want to keep a centralized RKObjetManager instance (via [RKObjectManager sharedManaged]), this is not really a good option.
is creating a specific RKObjectManager before each request and set my http headers as “default” the only solution or is there a better way?
There are a few options here:
NSURLRequestobject usingrequestWithObject:method:path:parameters:, configure theNSURLRequestappropriately, and then invokeobjectRequestOperationWithRequest:success:failure:ormanagedObjectRequestOperationWithRequest:managedObjectContext:success:failure:. This will let you configure the requests on a one-off basis.RKHTTPRequestOperationviasetHTTPOperationClass:onRKObjectManager. This will let you hook subclass in that can configure every NSURLRequest as the object manager makes requests, letting you centralize the configuration.RKObjectRequestOperationwith the manager that will be used for requests of your choosing, enabling you to centralize customization at the object request operation level.Options 1 or 2 are probably most appropriate for the HTTP level concern you outline, but I mention as an alternative for doing the same sort of customization at the object mapping level.