define the header in Alamofire

advertisements

i want to pass custom header in Alamofire.

[String : AnyObjetc]

I have surfed a lot on internet but fails to get the answer.

all the solutions are [String : String]

let headers = [
        "Authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
        "Content-Type": "application/x-www-form-urlencoded"
    ]

I want to pass like

let Header = [
    "ActorImageDetails" : [
        "TokenId":"bwymina009aEMyCknQHi87B2r0RNhffnrj8sXayGt1OSWsRmj2+daw==",
        "UserId":"400295",
        "AppId":"1"
     ]
]


Use the NSMutableURLRequest method setValue:ForHTTPHeaderField e.g.:

yourRequest.setValue("application/x-www-form-urlencoded" forHTTPHeaderField: "Content-Type")