How to get response headers when using Alamofire in Swift?

前端 未结 3 1663
时光说笑
时光说笑 2021-01-02 00:47

I\'m using Alamofire for my Rest (POST) request and getting JSON response seamlessly. But i can access only response body. I want to get response headers. Isn\'t it possible

3条回答
  •  天命终不由人
    2021-01-02 01:08

    As response is of NSHTTPURLResponse type, you should be able to get the headers as followed:

    response.allHeaderFields
    

提交回复
热议问题