title: I added a cookie to my URLSession, but it's missing in my URLRequest
body: <p>I'm stuck on an issue with cookies in a URLSession URLRequest. I have a Swift Playground where I add a cookie to my URLSession, and I expect to see it in the request to my local server, but it's not there. What am I missing? Here is my playground:</p>
  <pre class="lang-swift prettyprint-override"><code>import Foundation
  let config = URLSessionConfiguration.default
  config.httpCookieStorage?.setCookie(
      HTTPCookie(properties: [
          HTTPCookiePropertyKey.domain: &quot;http://localhost:8000&quot;,
          HTTPCookiePropertyKey.path: &quot;/&quot;,
          HTTPCookiePropertyKey.name: &quot;Eugene&quot;,
          HTTPCookiePropertyKey.value: &quot;Test&quot;,
          HTTPCookiePropertyKey.secure: &quot;TRUE&quot;,
          HTTPCookiePropertyKey.expires: Date(timeIntervalSinceNow: 1000000)
      ])!
  )
  config.httpShouldSetCookies = true
  config.httpCookieAcceptPolicy = .always
  let session = URLSession(configuration: config)
  print(session.configuration.httpCookieStorage?.cookies)
  var request = URLRequest(url: URL(string: &quot;http://localhost:8000&quot;)!)
  let task = session.dataTask(with: request) { data, urlResponse, error  in
      print(data)
      print(urlResponse)
      print(error)
  }
  task.resume()
  </code></pre>
  <p>This is the output of my playground:</p>
  <pre><code>Optional([&lt;NSHTTPCookie
      version:0
      name:Eugene
      value:Test
      expiresDate:'2021-06-05 15:25:19 +0000'
      created:'2021-05-25 01:38:39 +0000'
      sessionOnly:FALSE
      domain:http://localhost:8000
      partition:none
      sameSite:none
      path:/
      isSecure:TRUE
   path:&quot;/&quot; isSecure:TRUE&gt;])
  Optional(1318 bytes)
  Optional(&lt;NSHTTPURLResponse: 0x6000005c5500&gt; { URL: http://localhost:8000/ } { Status Code: 200, Headers {
      &quot;Content-Length&quot; =     (
          1318
      );
      &quot;Content-Type&quot; =     (
          &quot;text/html; charset=utf-8&quot;
      );
      Date =     (
          &quot;Tue, 25 May 2021 01:38:40 GMT&quot;
      );
      Server =     (
          &quot;SimpleHTTP/0.6 Python/3.8.2&quot;
      );
  } })
  nil
  </code></pre>
  <p>And this is the request the server sees, conspicuously missing the Cookie header:</p>
  <pre><code>127.0.0.1 - - [24/May/2021 20:38:40] &quot;GET / HTTP/1.1&quot; 200 -
  ERROR:root:Host: localhost:8000
  Accept: */*
  Accept-Language: en-us
  Connection: keep-alive
  Accept-Encoding: gzip, deflate
  User-Agent: URLSession/1 CFNetwork/1220.1 Darwin/20.3.0
  </code></pre>