RestKit 0.20.0pre5: HTTP headers per request

淺唱寂寞╮ 提交于 2019-12-05 16:53:30

There are a few options here:

  1. Obtain an NSURLRequest object using requestWithObject:method:path:parameters:, configure the NSURLRequest appropriately, and then invoke objectRequestOperationWithRequest:success:failure: or managedObjectRequestOperationWithRequest:managedObjectContext:success:failure:. This will let you configure the requests on a one-off basis.
  2. Configure a custom subclass of RKHTTPRequestOperation via setHTTPOperationClass: on RKObjectManager. This will let you hook subclass in that can configure every NSURLRequest as the object manager makes requests, letting you centralize the configuration.
  3. On the latest development branch, you can also register a subclass of RKObjectRequestOperation with 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!