title: Remembering cookies with Alamofire
body: <p>I'm trying to make my Alamofire manager instance automatically remember &amp; set cookies, here is my unsuccessful attempt :</p>
  
  <pre><code>let cfg = NSURLSessionConfiguration.defaultSessionConfiguration()
  let cooks = NSHTTPCookieStorage.sharedHTTPCookieStorage()
  
  // makes no difference whether it's set or left at default
  cfg.HTTPCookieStorage = cooks
  cfg.HTTPCookieAcceptPolicy = NSHTTPCookieAcceptPolicy.Always
  
  let mgr = Alamofire.Manager(configuration: cfg)
  
  mgr.request(NSURLRequest(URL: NSURL(string: "http://httpbin.org/cookies/set?stack=overflow"))).responseString {
      (_, _, response, _) in
      var resp = response // { "cookies": { "stack": "overflow" } }
      // becomes empty if cfg.HTTPCookieStorage set to nil
  }
  
  mgr.request(NSURLRequest(URL: NSURL(string: "http://httpbin.org/cookies"))).responseString {
      (_, _, response, _) in
      var resp = response // { "cookies": {} }
      // always empty no matter what
  }
  
  cooks.cookiesForURL(NSURL(string: "http://httpbin.org/cookies")) // 0 elements
  </code></pre>
  
  <p>The first URL sends a <code>Set-Cookie : stack=overflow; Path=/</code> header and then redirects (302) to <code>/cookies</code> (equivalent of the second URL); this works fine in my browser (once I hit the first URL the second URL always display that cookie) so I'd like to replicate that behavior with Alamofire.</p>