title: Sending custom HTTP headers in swift
body: <p>I managed to fetch json from my server but now I want to add extra security by way of http headers.  This is how my code barely looks like for now:</p>
  
  <pre><code>let urlPath = "http://www.xxxxxxxx.com"
          let url = NSURL(string: urlPath)
          let session = NSURLSession.sharedSession()
          let task = session.dataTaskWithURL(url!, completionHandler: { (data, response, error) -&gt; Void in
              if ((error) != nil) {
                  println("Error")
              } else {
                  // process json
                  let jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as! NSDictionary
  
                  println(jsonResult["user"])
              }
          })
  </code></pre>
  
  <p>The headers that I want to add to this request are the following:</p>
  
  <ul>
  <li>uid, which holds an integer value</li>
  <li>hash, which is a string</li>
  </ul>
  
  <p>If it helps, I have another app built in Titanium framework which uses this syntax:</p>
  
  <pre><code>xhr.setRequestHeader('uid', userid);
  xhr.setRequestHeader('hash', hash);
  </code></pre>
  
  <p>So, am basically looking for a Swift equivalent.</p>