JuliaWeb / HTTP.jl

HTTP for Julia
https://juliaweb.github.io/HTTP.jl/stable/
Other
632 stars 179 forks source link

Save and load cookie jar to file #931

Open olegshtch opened 2 years ago

olegshtch commented 2 years ago

Before update I could save cookies to CSV file as is and restore them from the file by creating Dict and populate it with created cookies. Now I had to generate Headers with Set-Cookie headers for it.

Could it be solved by adding constructor to CookieJar which accepts initial cookies?

quinnj commented 2 years ago

Yeah, this would be easy to provide. Note you can do:

jar = HTTP.CookieJar()
dict = jar.entries

But I'd also take a PR to add a constructor like:

CookieJar(entries::Dict{String, Dict{String, Cookie}}) = CookieJar(ReentrantLock(), entries)