Skip to content

Commit

Permalink
Add one more example for cookiejar
Browse files Browse the repository at this point in the history
  • Loading branch information
efectn committed May 13, 2024
1 parent 918c669 commit dc7d3d9
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions docs/client/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,39 @@ func main() {
[john=doe; path=/]
```
</details>

### Response 2

```go
func main() {
jar := client.AcquireCookieJar()
defer client.ReleaseCookieJar(jar)

cc := client.New()
cc.SetCookieJar(jar)

_, err := cc.Get("https://httpbin.org/cookies/set/john/doe")
if err != nil {
panic(err)
}

resp, err := cc.Get("https://httpbin.org/cookies")
if err != nil {
panic(err)
}

fmt.Println(resp.String())
}
```

<details>
<summary>Click here to see the result</summary>

```
{
"cookies": {
"john": "doe"
}
}
```
</details>

0 comments on commit dc7d3d9

Please sign in to comment.