Open bryanhonof opened 3 years ago
@bryanhonof Reason is to-basic-client-cookie
set discard to true
https://github.com/dakrone/clj-http-async/blob/877ee3b0dd3d586281e3528a5386ad4bd1f68a7d/src/clj_http/cookies.clj#L50
user=> (def c (clj-http.cookies/to-basic-client-cookie ["foo" {:value "bar"}]))
#'user/c
user=> (.isExpired c (new java.util.Date))
true
user=> (def d (org.apache.http.impl.cookie.BasicClientCookie2. "foo" "bar"))
#'user/d
user=> (.isExpired d (new java.util.Date))
false
user=> (.getExpiryDate c)
nil
user=> (.getExpiryDate d)
nil
user=>
It is showing discard
true because it is calling (.isPersistent cookie)
which is false in both cases, discard
is private variable
https://github.com/dakrone/clj-http/blob/dd15359451645f677b3e294164cf70330b92241d/src/clj_http/cookies.clj#L36
I'm trying to manually add a cookie to a cookie store, but I'm running into some problems.
Running the following code results in an empty set
Whilst running the following results in the expected set of 1 cookie.
Am I using the
add-cookie
, orto-basic-client-cookie
, wrong? Because as far as I understand the source code, both versions of my code should achieve the same results.