Description
Separating the cookie discussion from #1786
How would the authenticator change the token though? Since the authenticator is called on a per request basis, unless the tokens are static it needs to do something to configure them.
It can be done in the authenticator itself as I've done in the sample https://restsharp.dev/usage.html#authenticator
I would suggest Encode and EncodeQuery become part of the Options and would not be changed for a client instance.
Agreed
I am not sure it's desirable to have a shared cookie container for a single RestClient instance it that thing is cached forever.
I am not sure either as I never used it. But it always been a part of the client (or request, don't remember) for some reason. Yes, I think it was on the request, but since it is used for the message handler instantiation and cannot be changed, I had to move it to the client. I guess the discussion if it was a good decision, maybe not.
If there would be a way to specify cookies per request using headers, the cookie container could stay as-is, but AddCookie
in the client can be removed, or converted to AddDefaultCookie
, and we can add AddCookie
to the request, where it was previously.