URLRequest.httpShouldHandleCookies is broken beyond repair.

I create a new URLRequest(url: myUrl) object every time before calling URLSession.shared.dataTask(with: urlRequest).

I wait for one request to complete before making another call, so no timing problem possible. If I set it to false, it does not inject cookies. If I set it to true, it does send cookies. So everything is fine? NO!

If you sometimes set it to false for some calls and to true for other calls it will always not inject cookies. So if you set it to false, even if you set it to true for other calls it will never ever work.

I don't know how they manage to create such a bug, but it require some special kind of evil intentions.

Note : I always call the exact same domain and I always have my cookies.

I tested further with a tool to see the https traffic (Charles).

I can do this when I start the app urlRequest.httpShouldHandleCookies = true //Always inject cookies

Or I can do this when I start the app urlRequest.httpShouldHandleCookies = false //Never inject cookies

But if I change it on the fly, as soon as it is set to false, even if I set it to true later, it will never inject the cookies. urlRequest.httpShouldHandleCookies = isSendCookies //Never inject cookies

urlRequest.httpShouldHandleCookies control also the absorbtion of set-cookie, I thought it was taking the cookies from the WKWebview. My mistake, I will go hide under a rock now to hide my shame. This whole post should be deleted since it is useless.

URLRequest.httpShouldHandleCookies is broken beyond repair.
 
 
Q