swift - Why is not recommended to modify session configuration for authorization headers in Alamofire? -


from: https://github.com/alamofire/alamofire

modifying session configuration

... example code ...

this not recommended authorization or content-type headers. instead, use urlrequestconvertible , parameterencoding, respectively.

ok, not use it, why not recommended handling authorization headers?

there couple of reasons why recommend this.

  1. the session configuration headers should set not going change throughout lifecycle of session such accept-encoding, accept-language, user-agent, etc. if need set header possibly change between requests, should add header nsurlrequest takes precedence on session configuration headers.

  2. modifying session's configuration headers after configuration has been created not behavior consistently between ios 7 , ios 8. see thread more info.

hopefully helps clear things bit.


Comments