Isaaс Weisberg
Isaaс Weisberg

Reputation: 2824

URLSession: how to check what cookies were sent with the request?

There is no doubt that the HTTPCookie is indeed inside the HTTPCookieStorage, but I wonder if there is any way to confirm that it's being sent from programmatic standpoint?

Of course intercepting HTTP traffic via sniffers doesn't count.

Upvotes: 1

Views: 834

Answers (1)

Isaaс Weisberg
Isaaс Weisberg

Reputation: 2824

There is no way to check that programmatically - the notion of HTTPCookieStorage being configured on the URLSessionConfiguration leads to it completely obscuring the Cookie-related details from the programmer. It operates like magic way out of scope of your vision.

To be honest, I couldn't even tell you that happens if you set Cookie header manually via allHTTPHeaderFields but if there were already cookies for this very same domain and path in the HTTPCookieStorage - like, do they get merged, or does your custom header get discarded...

Upvotes: 2

Related Questions