Swift Alamofire add custom header to all requests

前端 未结 4 1771
北荒
北荒 2021-01-12 11:13

I tried to add custom header with this:

let manager = Manager.sharedInstance
manager.session.configuration.HTTPAdditionalHeaders = [
    \"Authorization\": \         


        
4条回答
  •  执念已碎
    2021-01-12 11:55

    I don't know where you do that but my AlomoFire requests look like :

     Alamofire.request(.GET, urlPath, parameters: parameters, headers: ["X-API-KEY": apiKey, "Content-type application":"json", "Accept application" : "json"]).responseJSON() { (req,res, data, error) in //blah blah }
    

    My guess is that you can put your header information into that headers array

提交回复
热议问题