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

Fix the expiration bug while adding cookies #1031

Merged
merged 4 commits into from
Sep 7, 2023

Conversation

inancgumus
Copy link
Member

@inancgumus inancgumus commented Sep 7, 2023

What?

  1. Fixes the expiration bug while adding cookies.
  2. Add an expiring cookie example.
  3. Fixes a bug in the test.

Why?

Users should be able to set cookies with an expiration date.

Checklist

  • I have performed a self-review of my code
  • I have added tests for my changes
  • I have commented on my code, particularly in hard-to-understand areas

Related PR(s)/Issue(s)

Closes #1025

A cookie passed to addCookie with an expiration date doesn't work. We
now take UNIX time since epoch in seconds and set the network.Cookie
property before setting it on the browser side.
Also fixes a bug in the test code:
tt.wantCookiesToSet, len(tt.cookies),

This was comparing the cookies to set to wantCookiesToSet. But, what we
want to compare with is the cookies that we get from the browser
context. While testing with expired cookies, we can give three cookies,
one of them should be expired and not to be found in the browser
context.
@inancgumus inancgumus added the bug Something isn't working label Sep 7, 2023
@inancgumus inancgumus self-assigned this Sep 7, 2023
Copy link
Collaborator

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🎉 Thanks for the fix! 🚀

@inancgumus inancgumus merged commit 771ce83 into main Sep 7, 2023
12 checks passed
@inancgumus inancgumus deleted the fix/add-cookies-expiration branch September 7, 2023 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cookies: Setting the expiration property fails while adding cookies
2 participants