title: Alamofire request with cookies
body: <p>I'm beginner and I can't figure out how to make a .GET request (however it requires autenthication) with Alamofire. I managed to do this with other web service (login) because it takes parameters argument:</p>
  
  <pre><code>parameters = [
   "username" : username
  "password" : password 
  ]
  </code></pre>
  
  <p>Then:</p>
  
  <pre><code>Alamofire.request(.POST, loginUrl, parameters: parameters).responseJSON { (request, response, data, error) -&gt; Void in
  
       //handling the response       
  }
  </code></pre>
  
  <p>In response header I get some information:</p>
  
  <pre><code>[Transfer-Encoding: Identity, Server: nginx/1.4.1, Content-Type: application/json, P3P: policyref="http://www.somewebpage.com", CP="NON DSP COR CURa TIA", Connection: keep-alive, Date: Sun, 08 Mar 2015 13:49:20 GMT, Vary: Accept-Encoding, Cookie, Set-Cookie: sessionid=5xeff47e65f674a4cc5b2d54f344304b; Domain=.somedomain.com; Path=/, tbauth=1; Domain=.somedomain.com; Path=/, Content-Encoding: gzip]
  </code></pre>
  
  <p>It's of type <code>[NSObject : AnyObject]</code></p>
  
  <p>What should I do with that information to store it in NSURLDefaults and prepare valid request parameter (cookie)? Do I need all fields or just Set-Cookie?</p>
  
  <p>I tried manually set parameter:</p>
  
  <pre><code>parameters = [
   "Cookie" : "sessionid=5xeff47e65f674a4cc5b2d54f344304b; Domain=.somedomain.com; Path=/, tbauth=1; Domain=.somedomain.com; Path=/"
  ]
  </code></pre>
  
  <p>but it does return error NSURLErrorDomain -1017 (NSURLErrorCannotParseResponse)</p>
  
  <p>Thanks for all responses.</p>