Not wanting to dupe #515 but is it possible to extract HTTP response headers from an RxMoya.Response object? The issue didn't seem to be adequately addressed there.
Cheers! 😄
So it turns out that the RxMoya.Response value comes out of a request as an NSHTTPURLResponse, thus giving access to the HTTP headers:
(lldb) po (response.response as? NSHTTPURLResponse)?.allHeaderFields
â–¿ Optional<Dictionary<NSObject, AnyObject>>
â–¿ Some : 15 elements
â–¿ [0] : 2 elements
- .0 : Content-Type
- .1 : application/json; charset=utf-8
...
which is great. I didn't pick it up as the generated headers for the Moya framework show the RxMoya.Response value as being an NSURLResponse, as was pointed out in #515 .
Thanks either way! 😄
Most helpful comment
So it turns out that the
RxMoya.Responsevalue comes out of a request as anNSHTTPURLResponse, thus giving access to the HTTP headers:which is great. I didn't pick it up as the generated headers for the Moya framework show the
RxMoya.Responsevalue as being anNSURLResponse, as was pointed out in #515 .Thanks either way! 😄