requests icon indicating copy to clipboard operation
requests copied to clipboard

fix: handle empty string cookie values correctly

Open shindonghwi opened this issue 11 months ago • 0 comments

_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.

shindonghwi avatar Dec 19 '25 03:12 shindonghwi