Is there any reason why get
and get_private
CookieJar
functions have a different return value?
#2639
-
Looking at the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes. |
Beta Was this translation helpful? Give feedback.
Yes.
get()
returns a cookie where the internal value borrows from the request, since its value is identical (modulo percent decoding, which we cache) to what the client sent.get_private()
fetches a private cookie, whose value, on the other hand, is encrypted (and signed). The logical value, the decrypted value, is thus different than the value already in memory, and thus we cannot borrow it from the request. We must allocate to store said value, hence the owned-ness of the returnedCookie
.