Is there a way to do this? I've tried various serialization libraries in an attempt to serialize a bhttp session object, however there are some native objects buried in there that prevent it from working. The reason I want to do this is I am writing a command-line utility that maintains a state between invocations (sort of like git) and I want to retain session data without having to re-login each time.
Is there a way to do this? I've tried various serialization libraries in an attempt to serialize a bhttp session object, however there are some native objects buried in there that prevent it from working. The reason I want to do this is I am writing a command-line utility that maintains a state between invocations (sort of like git) and I want to retain session data without having to re-login each time.
Any suggestions?
update: I figured it out -- the secret is that bhttp uses tough-cookie by default to manage cookies, and in 2015 tough-cookie added a serialization / deserialization routine that is compatible with JSON. Basically see this commit in tough-cookie: https://github.com/salesforce/tough-cookie/pull/42/files#diff-04c6e90faac2675aa89e2176d2eec7d8R337
In my case, serialization and deserialization were handled as follows: