Skip to content

Adding client-level cookie container - #2042

Merged
alexeyzimarev merged 3 commits into
devfrom
client-level_-cookies
Apr 3, 2023
Merged

Adding client-level cookie container#2042
alexeyzimarev merged 3 commits into
devfrom
client-level_-cookies

Conversation

@alexeyzimarev

Copy link
Copy Markdown
Member
  • Added a custom cookie container to RestClientOptions
  • It will not be added to the message handler
  • Cookies will be added as headers the same way as request cookies

@alexeyzimarev
alexeyzimarev requested a review from kendallb April 1, 2023 12:43
@kendallb

kendallb commented Apr 1, 2023

Copy link
Copy Markdown
Contributor

My concern would be adding the cookies to the container in the request because if the user is using a request specific container that they are maintaining, it means the client ones will end up in that container after the request.

cookieContainer.Add(Options.CookieContainer.GetCookies(url));

Is it feasible to simply call headers.AddCookieHeaders(cookieContainer, url) for both cookie containers rather than combine them?

@alexeyzimarev

Copy link
Copy Markdown
Member Author

Yeah, I thought about that as one of the options, but I haven't considered the request container concern. You are right, will change it now.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 1, 2023

Copy link
Copy Markdown

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: c121623
Status: ✅  Deploy successful!
Preview URL: https://92532ab6.restsharp.pages.dev
Branch Preview URL: https://client-level--cookies.restsharp.pages.dev

View logs

@alexeyzimarev

Copy link
Copy Markdown
Member Author

@kendallb I updated it following your comment.

@kendallb

kendallb commented Apr 1, 2023

Copy link
Copy Markdown
Contributor

Looks good to me

@alexeyzimarev
alexeyzimarev merged commit 4287eaf into dev Apr 3, 2023
@repo-ranger
repo-ranger Bot deleted the client-level_-cookies branch April 3, 2023 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants