Swift,我如何从RestKit获取响应头?

时间:2017-02-28 13:12:42

标签: swift3 restkit

我有一个RestKit请求如下。如何从响应头中获取身份验证令牌?

       -inkey privkey.pem \

           -out keystore.p12 \

       -name tomcat \

       -CAfile chain.pem \

       -caname root

1 个答案:

答案 0 :(得分:2)

您可以像这样从RKObjectRequestOperation获取响应标头。

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
}