markhorrocks
markhorrocks

Reputation: 1418

Swift, how can I get response headers from RestKit?

I have a RestKit request as below. How can I get the auth token from the response headers?

    RKObjectManager.shared()
        .getObjectsAtPath(urlString,
                      parameters: paramsDictionary,
             success: {(operation: RKObjectRequestOperation?, result: RKMappingResult?) -> Void in



pod 'RestKit', '~> 0.27.0'

Upvotes: 0

Views: 187

Answers (1)

Nirav D
Nirav D

Reputation: 72410

You can get response header from RKObjectRequestOperation like this way.

if let operation = operation, let headers = operation.httpRequestOperation.response.allHeaderFields as? [String:Any] {
    print(headers)// Now use subscript with headers dictionary to get your token value
}

Upvotes: 2

Related Questions