cookiejar

package
v0.0.0-...-eeef46a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Jar

type Jar struct {
	*cookiejar.Jar
	// contains filtered or unexported fields
}

Jar implements http.CookieJar by embedding a *cookiejar.Jar.

It accesses the private fields of *cookiejar.Jar via reflection to read/write the contents to/from a JSON file.

func Open

func Open(filepath string) (*Jar, error)

Open opens a new jar at the given location, reading contents from disk if present.

func (*Jar) MarshalJSON

func (j *Jar) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for Jar by marshaling the "entries" field of the embedded cookiejar.Jar. It obtains a lock on the embedded jar before reading the entries field.

func (*Jar) Save

func (j *Jar) Save() error

Save saves the contents of the embedded cookiejar.Jar to the file. It obtains a write lock on the file before writing the contents. A lock on the contents of the cookiejar.Jar is obtained when marshaling the JSON.

func (*Jar) UnmarshalJSON

func (j *Jar) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler for Jar by unmarshaling the bytes into the "entries" field of the embedded cookiejar.Jar. It obtains a lock on the embedded jar before writing to it. It will fail if the jar is not empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL