Add additional headers to Alamofire Session

168 Views Asked by At

Session Configuration:

func createAfSession() -> Alamofire.Session {
    let sessionConfig = URLSessionConfiguration.af.default
    sessionConfig.headers.add(name: "abc", value: "ABC")
    return Alamofire.Session(configuration: sessionConfig)
}

Created Session:

var afSession = self.createAfSession()

Facing challenge in adding header in created session:

afSession.sessionConfiguration.headers.add(name: "prq", value: "PQR") "Not added to headers"

I want to add header in session only not in Alamofire's Request.

0

There are 0 best solutions below