# Cookiejar

Since version 1.0.0 the TLS-Client uses the custom cookiejar implemented which can be found here: <https://github.com/bogdanfinn/tls-client/blob/master/jar.go> \
Before it was more or less golangs default cookiejar: <https://github.com/bogdanfinn/fhttp/blob/master/cookiejar/jar.go>

The custom cookiejar is designed for some specific (sneaker)botting related use cases when it comes to cookie overwriting or sharing cookies across different TLD. Often these use cases were about overwriting exisiting cookies in the jar with newer values or something like that.

When using the TLS-Client in go you can easilly switch between both jars just by instantiating the specific cookiejar you need:

#### Default Go Cookiejar

```
jar, _ := cookiejar.New(nil)
options := []tls_client.HttpClientOption{
   tls_client.WithCookieJar(jar),
}

client, err := tls_client.NewHttpClient(tls_client.NewNoopLogger(), options...)
```

#### Custom Cookiejar

```
jar := tls_client.NewCookieJar()

options := []tls_client.HttpClientOption{
   tls_client.WithCookieJar(jar),
}

client, err := tls_client.NewHttpClient(logger, options...)
```

#### Shared Library & Standalone API

If you are using the shared library or standalone api you can either completely deactiavte cookie jar handling by setting `"withoutCookieJar"` to `true` or you can switch to the default Go cookiejar by setting `"withDefaultCookieJar"` to `true`. By default the Custom Cookiejar will always be used.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bogdanfinn.gitbook.io/open-source-oasis/readme/cookiejar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
