0
votes

I need to PUT/POST data to a service. Upon success, the server returns 201/Created (no body). The parameters are (necessarily) a NSDictionary, so no object binding on either side is needed. RKObjectManager.requestWithObject works fine for this, but raises an error it expected a 204 rather than a 201. As far as I can tell, the only place to alter expected status codes is in a matching RKResponseDescriptor. RKResponseDescriptors seem like overkill for a response which has no body, and I'm unsure how to even construct one that works with no body. How can I tell RestKit that a 201 is OK for this POST?

Update I eventually gave up on trying to do requests that didn't involve any sort of binding (ie, posting a dictionary and receiving a 201 response), and just dropped down to NSURLConnection stuff - it wasn't bad)

1

1 Answers

1
votes

On your RKObjectRequestOperation:

operation.HTTPRequestOperation.acceptableStatusCodes = [NSIndexSet indexSetWithIndex:201];