Closed 10ne1 closed 2 years ago
Oh, that's fascinating! I like the fix. Would you mind adding a test for this too?
Sure, I'll add a test.
Adding some more context on my use case in case you find it interesting: I need to share cookies between fantoccini/webdriver and reqwest for a hobby project, so I've been uncovering some corner cases on both sides (for e.g. I also just posted this fix for reqwest client cookie_store which was loosing some cookie info when adding/removing to its store).
Merging #192 (23db532) into main (d60a41d) will not change coverage. The diff coverage is
66.66%
.
Released in 0.20.0-rc.2
:tada:
Fetching all cookies from fantoccini client and loading them back reveals that same_site is not properly parsed when converting from Cookie -> WebDriverCookie.
For example, client.get_all_cookies() can return both the following same_site values in different cookies, the second of which is transformed by the map call into an Option::None which gets ignored by WebDriverCookie serde skip_serializing_if = "Option::is_none":
same_site: Some( None, ),
same_site: None,
An example error when calling client.add_cookie() with the above "same_site: None":
thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: Standard(WebDriver { error: InvalidArgument, message: "invalid argument: invalid 'sameSite'\n (Session info: chrome=98.0.4758.80)"This fixes the error by parsing the top-level None value to a None string as expected by WebDriverCookie.