Skip to content

Conversation

@shindonghwi
Copy link

_find_no_duplicates() was checking if toReturn: which treats empty string as falsy.

This causes KeyError when retrieving a cookie with an empty string value:

jar = RequestsCookieJar()
jar.set("empty", "")
jar["empty"]  # KeyError!

Fixed by checking if toReturn is not None: instead.

Added test case.

_find_no_duplicates() was using 'if toReturn:' which treats empty
string as falsy, causing KeyError when retrieving cookies with
empty string values. Changed to 'if toReturn is not None:' to
properly handle this case.
@shindonghwi shindonghwi reopened this Dec 19, 2025
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.

1 participant