Moya: How to get response headers

Created on 23 Jun 2016  路  4Comments  路  Source: Moya/Moya

Hi,

I'm wondering how can I get the response headers ? e.g access_token or content-type

Thanks,
Ravi.

Most helpful comment

@iiiyu On your success you just need to do that :

if let httpResponse = value.response as? NSHTTPURLResponse {
   debugPrint(httpResponse.allHeaderFields)
}

All 4 comments

I also met the same problem, @Ravichandrane can you tell me is how to solve.

@iiiyu On your success you just need to do that :

if let httpResponse = value.response as? NSHTTPURLResponse {
   debugPrint(httpResponse.allHeaderFields)
}

@Ravichandrane Thanks for your reply.
MoyaProvider is work.
But RxMoyaProvider response is NSURLResponse.
So I don't use RxMoyaProvider.
Thanks again.

What is the way to do this with reactive extensions?

Was this page helpful?
0 / 5 - 0 ratings