Skip to content

Commit

Permalink
GH #330 Addressing nil pointer error while accessing cookie jar on us…
Browse files Browse the repository at this point in the history
…er provided http client
  • Loading branch information
jeevatkm committed May 11, 2020
1 parent 98f59aa commit ed8068d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,13 @@ func composeHeaders(c *Client, r *Request, hdrs http.Header) string {
var v string
if k == "Cookie" {
cv := strings.TrimSpace(strings.Join(hdrs[k], ", "))
for _, c := range c.GetClient().Jar.Cookies(r.RawRequest.URL) {
if cv != "" {
cv = cv + "; " + c.String()
} else {
cv = c.String()
if c.GetClient().Jar != nil {
for _, c := range c.GetClient().Jar.Cookies(r.RawRequest.URL) {
if cv != "" {
cv = cv + "; " + c.String()
} else {
cv = c.String()
}
}
}
v = strings.TrimSpace(fmt.Sprintf("%25s: %s", k, cv))
Expand Down

0 comments on commit ed8068d

Please sign in to comment.