Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to set a cookie for a domain? #58

Open
mark8044 opened this issue Jul 3, 2024 · 1 comment
Open

Is it possible to set a cookie for a domain? #58

mark8044 opened this issue Jul 3, 2024 · 1 comment

Comments

@mark8044
Copy link

mark8044 commented Jul 3, 2024

From the way Ive been using it, CookieJar is reading a cookie and saving them to be used later.

  1. But is there a way for me to SET a cookie, say I provide the domain and cookie values?
  2. Is there a way to read what cookies are stored for debug purposes?
@alexrabin-sentracam
Copy link

Read the documentation. Both of your questions can be answered in the first example in the README:

 final cookieJar = CookieJar();
  List<Cookie> cookies = [Cookie('name', 'wendux'), Cookie('location', 'china')];
  // Saving cookies.
  await cookieJar.saveFromResponse(Uri.parse('https://pub.dev/'), cookies);
  // Obtain cookies.
  List<Cookie> results = await cookieJar.loadForRequest(Uri.parse('https://pub.dev/paths'));
  print(results);

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

No branches or pull requests

2 participants