Skip to content

Commit

Permalink
cookiejar.New never fails (net/http)
Browse files Browse the repository at this point in the history
  • Loading branch information
presbrey committed Aug 9, 2024
1 parent e5f5358 commit 2f2b3dc
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions multiproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,7 @@ func NewClient(config Config) (*Client, error) {
}
}

jar, err := cookiejar.New(config.CookieOptions)
if err != nil {
return nil, fmt.Errorf("failed to create cookie jar: %v", err)
}
jar, _ := cookiejar.New(config.CookieOptions)

c.states[i] = proxyState{
client: &http.Client{
Expand Down Expand Up @@ -185,10 +182,7 @@ func (c *Client) do(req *http.Request) (*http.Response, error) {
}

if c.config.CookieTimeout > 0 && now.Sub(state.lastUsed) > c.config.CookieTimeout {
jar, err := cookiejar.New(c.config.CookieOptions)
if err != nil {
return nil, fmt.Errorf("failed to create new cookie jar: %v", err)
}
jar, _ := cookiejar.New(c.config.CookieOptions)
state.cookieJar = jar
state.client.Jar = jar
}
Expand Down

0 comments on commit 2f2b3dc

Please sign in to comment.