I’m working on a project in Julia and I’m using the HTTP.jl package for handling HTTP requests. I’m wondering how I can create a connection and make multiple requests while maintaining cookies and session data. Specifically, I’d like to know:
How to establish a connection using HTTP.jl that can persist across multiple requests?
How to manage cookies and session data between these requests?
HTTP.jl actually does cookie management for you by default. This is controlled via the cookies and cookiejar keyword arguments. By default, cookie=true, which means the default global cookie jar will be checked against the current request url for cookies that should automatically be included before the request is actually sent. When the response is received, set-cookie headers are checked and if found, the cookies are stored in the same global default cookiejar.