title: Setting cookies to httpClient of Asp.Net Core TestServer
body: <p>I,m testing ASP.NET Core app with TestServer, and there are controllers that require cookie auth. I've created test server instance like this:</p>
  
  <pre><code>_testServer = new TestServer(new WebHostBuilder()
              .UseEnvironment(CustomEnvironments.Test)
              .UseContentRoot(currentDirectory)                
              .UseStartup&lt;Web.Startup&gt;()
              .UseUrls("http://localhost/"));
  
  ApiClient = _testServer.CreateClient();
  </code></pre>
  
  <p>and now I have to add auth cookie, but it is ignored by server. If the client could be created directly I could pass <code>HttpClientHandler</code> to constractor and set <code>UseCookies</code> to false, and it works, but I can't access the handler when I get client from test server. Is there a way to add auth cookies to test client?</p>