Skip to content

Commit d702aad

Browse files
committed
fix: SetCookieJarFactory returns http.CookieJar interface
Closes #415. Closes PR #486 by @kaylee595. Changes cookiejarFactory return type from *cookiejar.Jar to http.CookieJar interface, allowing users to provide custom cookie jar implementations instead of being restricted to the standard library's cookiejar.Jar.
1 parent 1e34ab9 commit d702aad

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type Client struct {
5252
AllowGetMethodPayload bool
5353
*Transport
5454
digestAuth *digestAuth
55-
cookiejarFactory func() *cookiejar.Jar
55+
cookiejarFactory func() http.CookieJar
5656
trace bool
5757
disableAutoReadResponse bool
5858
commonErrorType reflect.Type
@@ -1557,7 +1557,7 @@ func (c *Client) Clone() *Client {
15571557
return &cc
15581558
}
15591559

1560-
func memoryCookieJarFactory() *cookiejar.Jar {
1560+
func memoryCookieJarFactory() http.CookieJar {
15611561
jar, _ := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
15621562
return jar
15631563
}
@@ -1604,7 +1604,7 @@ func C() *Client {
16041604
// cookie jar that store cookies for underlying `http.Client`. After client clone,
16051605
// the cookie jar of the new client will also be regenerated using this factory
16061606
// function.
1607-
func (c *Client) SetCookieJarFactory(factory func() *cookiejar.Jar) *Client {
1607+
func (c *Client) SetCookieJarFactory(factory func() http.CookieJar) *Client {
16081608
c.cookiejarFactory = factory
16091609
c.initCookieJar()
16101610
return c

0 commit comments

Comments
 (0)